If I want to add my class where do I add it? as a module or as a controller? class Contact def initialize(name, email, message) @name = name @email= email @message= message end def name(name) @name = name end def email(email) @email= email end def message(message) @message= message end end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
inside in your application under app/*model* folder. And if it is a module then insert it inside the lib folder. On Tue, Oct 7, 2008 at 5:04 PM, Pepe Sanchez < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > If I want to add my class where do I add it? > > as a module or as a controller? > > class Contact > def initialize(name, email, message) > @name = name > @email= email > @message= message > end > > def name(name) > @name = name > end > > def email(email) > @email= email > > end > > def message(message) > @message= message > end > > end > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You should put it under lib/contact.rb if you want to follow the general convention. On Tue, Oct 7, 2008 at 12:34 PM, Pepe Sanchez <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > If I want to add my class where do I add it? > > as a module or as a controller? > > class Contact > def initialize(name, email, message) > @name = name > @email= email > @message= message > end > > def name(name) > @name = name > end > > def email(email) > @email= email > > end > > def message(message) > @message= message > end > > end > -- > Posted via http://www.ruby-forum.com/. > > > >-- Cheers! - Pratik http://m.onkey.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> You should put it under lib/contact.rb if you want to follow the > general convention.Really? It seems to me that Contact (ActiveRecord subclass or not) would be a legitimate model object in a MVC system. I could see putting some utility classes and stuff that doesn''t really have a place in MVC in the lib folder. That seems perfectly reasonable to me. Not everything can be pigeon-holed into any specific design pattern. So are you saying that any model object that is not subclassing ActiveRecord::Base should not be kept inside the app/models folder? Even when it is obviously a model object managing data, even when that data may not be persisted to a database table. I''m just looking for some clarification here. Is this just a developer preference on how to organize classes? Or, are their issues surrounding keeping non-ActiveRecord model objects in the /app/models folder? Pratik Naik wrote:> You should put it under lib/contact.rb if you want to follow the > general convention....snip...> Cheers! > - Pratik > http://m.onkey.org-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---