Hi, I''m trying to create a simple contact form. It might use the database later for storing the messages, but not yet, I don''t think. However, I''d still like to be able to validate the fields easily, like you would with ActiveRecord. How can I do this? I''m new to rails so really don''t know where to start. Thanks, Brandon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Fri, Mar 27, 2009 at 4:05 PM, Brandon Olivares <programmer2188-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m trying to create a simple contact form. It might use the database later > for storing the messages, but not yet, I don''t think. However, I''d still > like to be able to validate the fields easily, like you would with > ActiveRecord. > > How can I do this? I''m new to rails so really don''t know where to start.You can validate an ActiveRecord object using valid?. http://api.rubyonrails.org/classes/ActiveResource/Validations.html#M000832 This will ensure any model validation you include are ran. -- Greg Donald http://destiney.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 -~----------~----~----~----~------~----~------~--~---
> -----Original Message----- > From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails- > talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Greg Donald > Sent: Friday, March 27, 2009 5:11 PM > To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Subject: [Rails] Re: Forms without a database backend > > You can validate an ActiveRecord object using valid?. > > http://api.rubyonrails.org/classes/ActiveResource/Validations.html#M000 > 832 > > This will ensure any model validation you include are ran. > >Thanks, but should I create an ActiveRecord model even though it shouldn''t be associated with a table? Brandon> -- > Greg Donald > http://destiney.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 -~----------~----~----~----~------~----~------~--~---
On Fri, Mar 27, 2009 at 4:16 PM, Brandon Olivares <programmer2188-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks, but should I create an ActiveRecord model even though it shouldn''t > be associated with a table?It would probably be the easiest way to get to the model validations. -- Greg Donald http://destiney.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 -~----------~----~----~----~------~----~------~--~---
Have a look at the activerecord_base_without_table plugin: http://agilewebdevelopment.com/plugins/activerecord_base_without_table. It''s very simple and I use it a lot in my projects. However, if you ever get into a situation that the framework does a ''describe'' ( DESC ) on it, it will fail. Therefore, I modified the plugin to set the table name to "dual". Works like a charm! On 27 mar, 17:18, Greg Donald <gdon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Fri, Mar 27, 2009 at 4:16 PM, Brandon Olivares > > <programmer2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Thanks, but should I create an ActiveRecord model even though it shouldn''t > > be associated with a table? > > It would probably be the easiest way to get to the model validations. > > -- > Greg Donaldhttp://destiney.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 -~----------~----~----~----~------~----~------~--~---