@@ -247,6 +247,19 @@ class Post < ApplicationRecord
247247end
248248```
249249
250+ For multi-tenant setups, you can bind a non-default Uploadcare config:
251+
252+ ``` ruby
253+ class Post < ApplicationRecord
254+ mount_uploadcare_file :picture , uploadcare_config: -> {
255+ Uploadcare ::Rails .client_config(
256+ public_key: tenant_uploadcare_public_key,
257+ secret_key: tenant_uploadcare_secret_key
258+ )
259+ }
260+ end
261+ ```
262+
250263``` erb
251264<!-- app/views/posts/new.html.erb -->
252265<h1> NEW POST </h1>
@@ -272,6 +285,8 @@ class Post < ApplicationRecord
272285end
273286```
274287
288+ ` mount_uploadcare_file_group ` also supports ` uploadcare_config: ` in the same way.
289+
275290``` erb
276291<!-- app/views/posts/new.html.erb -->
277292<h1> NEW POST </h1>
@@ -372,18 +387,12 @@ Now the `post.picture` is an Uploadcare::Rails::File. Following methods are supp
372387``` ruby
373388# Store the file on an Uploadcare server permanently:
374389post.picture.store
375- # => {
376- # "cdn_url"=>"https://ucarecdn.com/2d33999d-c74a-4ff9-99ea-abc23496b052/",
377- # ...other group data...
378- # }
390+ # => #<Uploadcare::Rails::File ...>
379391
380392#
381393# Delete the file from an Uploadcare server permanently:
382394post.picture.delete
383- # => {
384- # "datetime_removed"=>"2021-07-30T09:19:30.797174Z",
385- # ...other group data...
386- # }
395+ # => #<Uploadcare::File ...>
387396
388397# Get CDN-url of an object attribute:
389398post.picture.to_s
@@ -393,10 +402,7 @@ post.picture.to_s
393402# This data will be cached if the cache_files option is set to true
394403# Default data (without asking an Uploadcare server) for each file contains cdn_url and uuid only:
395404post.picture.load
396- # => {
397- # "cdn_url"=>"https://ucarecdn.com/2d33999d-c74a-4ff9-99ea-abc23496b052/",
398- # ...other file data...
399- # }
405+ # => #<Uploadcare::Rails::File ...>
400406
401407# Check if an attribute loaded from the server.
402408# Will return false unless the :load or the :store methods are called:
@@ -431,37 +437,20 @@ Now the `post.attachments` is an Uploadcare::Rails::Group. Following methods are
431437``` ruby
432438# Store the file group on an Uploadcare server permanently:
433439post.attachments.store
434- # => {
435- # "cdn_url"=>"https://ucarecdn.com/dbc4e868-b7a6-43ff-a35f-2ebef935dc1b~1/",
436- # ...other group data...
437- # "files"=> [{
438- # "datetime_stored"=>"2021-07-29T08:31:45.668354Z",
439- # ...other file data...
440- # }]
441- # }
440+ # => #<Uploadcare::Group ...>
442441
443442#
444443# Delete the file group from an Uploadcare server permanently:
445444post.attachments.delete
446- # => {
447- # "datetime_removed"=>"2021-07-30T09:19:30.797174Z",
448- # ...other group data...
449- # }
445+ # => #<direct SDK response payload>
450446
451447# Get CDN-url of an object attribute:
452448post.attachments.to_s
453449# => "https://ucarecdn.com/dbc4e868-b7a6-43ff-a35f-2ebef935dc1b~1/"
454450
455451# Load object — works the same way as for the File:
456452post.attachments.load
457- # => {
458- # "cdn_url"=>"https://ucarecdn.com/dbc4e868-b7a6-43ff-a35f-2ebef935dc1b~1/",
459- # ...other group data...
460- # "files"=> [{
461- # "datetime_stored"=>"2021-07-29T08:31:45.668354Z",
462- # ...other file data...
463- # }]
464- # }
453+ # => #<Uploadcare::Rails::Group ...>
465454
466455# Check if an attribute loaded from the server:
467456post.attachments.loaded?
0 commit comments