Hello, I'm trying to use the following Struct in my web app: UserInfo = Struct.new( "UserInfo", :first_name, :last_name, :email, :domain_name ) I placed this in the environment.rb, thinking that it should be initialized only once. But when I try to access it from within my controller, I get: undefined method `UserInfo' for #<UserController:0x243ad5c>. so my questions are: 1) is environment.rb the correct place to define a struct? If not, what's the alternative. Also, what's the best place to define classes that are neither controllers nor models? 2) if struct definition in environment.rb is the proper place to define a struct, how can I get my controller to know what a UserInfo is? Thanks in advance. Cagan
on 2006-06-14 11:51
on 2006-06-14 12:38
On 6/14/06, cagan senturk <email@example.com> wrote: > 1) is environment.rb the correct place to define a struct? If not, > what's the alternative. Also, what's the best place to define classes > that are neither controllers nor models? I'm not fully awake yet, but I think you may want to place it in your application.rb instead, or in a separate module/helper and make sure you include it. HTH Mathias.