Hi-
Where do you put your ‘require’ statements in a rails app?
For example, if I want to include a different gem, where do I place
this?
require ‘lib’
Thanks!
Hi-
Where do you put your ‘require’ statements in a rails app?
For example, if I want to include a different gem, where do I place
this?
require ‘lib’
Thanks!
Put it where you’re using it? If you need it in a paricular controller
(which is hopefully where you need it… hate to see it in a model),
then just call it there. You can require anywhere… but the best
practices I don’t know about.
class AvatarController > etc
require “RMagick”
#etc
end
Ok, I’ll put it in the controller, unless someone tells me it’s bad
style
Thanks!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs