Rails 4: where to place Struct? -
Where should I place a simple structure so that every model / controller can use it?
Right now I'm just defining this structure in every model. You have to place it anywhere in your load path and name the file as 'errors.rb' needed. The best place will probably be within Errors = Straight.New (: file_name ,: errors)
lib , assuming that you have it in your
config / application.rb :
config Load_paths are added in. Autoload_paths & lt; & Lt; Config.root.join ('lib')
Comments
Post a Comment