Answer the question
In order to leave comments, you need to log in
Where to store the background image of a Rails application?
I have several sections in my application, each of which uses its own background, there is also a “default” background that is displayed on all other sections and on the sections described above if the background is not loaded there.
Question: how best to organize the storage and loading of background images?
I use the carrierwave gem, it was possible to create a field in the section model in which to store the background using carrierwave, which would be enough, but then what to do with the default background?
Answer the question
In order to leave comments, you need to log in
That is, sections are dynamic, for example, categories from the database?
Whereas in another way, if you still want to change the picture sometimes, then store the path to the picture in the database.
And if everything is fixed, for example, make a separate layout for a specific controller, where to register a different background image and use this layout in the controller
class CategoriesController < ApplicationController
layout 'имя лайаута из папки layout'
end
mount_uploader :background, BackgroundUploader
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question