Where should I put a simple Struct so that every model/controller would be able to use it?
Errors = Struct.new(:file_name, :errors)
Right now I'm just defining this structure in every model.
You need to place it anywhere in your load paths and the file needs to be named 'errors.rb'. Best place probably would be within lib
, assuming you have added it to your load_paths in your config/application.rb
:
config.autoload_paths << config.root.join('lib')
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments