You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we should extend the configuration to enable per resource or per uploader customization. When you set the initializer, it really only address one type of resource. What if I have a project and user model and they have drastically different carrierwave versions. Rather than having to default to projects and inline my user model, we should allow the gem to pull global configs on a per resource basis.
*Option 1: Class Method
We can allow users to define the configuration in the model as a class method, i..e:
Option 2: Custom Object
We can create a custom object for sizes, ResponsiveImages::Config that can define the default config. Custom configs could inherit from the default and define the customizations:
Any calls to responsive_image_tag or responsive_background_image would use the default config. You would create custom configs by inheriting from the default config:
I think we should extend the configuration to enable per resource or per uploader customization. When you set the initializer, it really only address one type of resource. What if I have a
project
anduser
model and they have drastically different carrierwave versions. Rather than having to default to projects and inline my user model, we should allow the gem to pull global configs on a per resource basis.*Option 1: Class Method
We can allow users to define the configuration in the model as a class method, i..e:
We can probably even make this a method called in the model:
Option 2: Custom Object
We can create a custom object for sizes,
ResponsiveImages::Config
that can define the default config. Custom configs could inherit from the default and define the customizations:Any calls to
responsive_image_tag
orresponsive_background_image
would use the default config. You would create custom configs by inheriting from the default config:To use the custom config, you would pass it as an argument to the helper method, i.e.:
Let me know if there are any other, or better, options.
The text was updated successfully, but these errors were encountered: