hi all,
I want to make a custom data class. Where do I best store that class
in my rails structure? Do I need to include that class somewhere ?
Thanks
Stijn
hi all,
I want to make a custom data class. Where do I best store that class
in my rails structure? Do I need to include that class somewhere ?
Thanks
Stijn
Tarscher wrote:
I want to make a custom data class. Where do I best store that class
in my rails structure? Do I need to include that class somewhere ?
If this is a class that doesn’t have a database table, you can put it
into a file with the same name as the class but lowercase (and ending in
“.rb”) in the “lib” directory. So for an Item class, add:
lib/item.rb
When you refer to the class, this is one of the places Rails
automatically looks.
Tarscher wrote:
hi all,
I want to make a custom data class. Where do I best store that class
in my rails structure? Do I need to include that class somewhere ?Thanks
Stijn
Usually that would go in RAILS_ROOT/lib. You can then ‘require’ it in
your environment.rb.
–
http://www.5valleys.com/
http://www.workingwithrails.com/person/8078
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