Hey, This is hopefully a very basic question, though I couldn''t find a nice tutorial for that. I want to make in Rails3 a simple contact form, but with validation. So I thought, that I would use ActiveRecord for that, but it''s obvious that I don''t want a table for that. So the question is how to make such a form with validation in Rails3 DRY way? I would be grateful for a piece of code for the controller and the class itself. Thanks. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Dec-29 16:18 UTC
Re: Simple Contact Form - ActiveRecord without a table
wardenik wrote in post #971297:> Hey, > > This is hopefully a very basic question, though I couldn''t find a nice > tutorial for that. > I want to make in Rails3 a simple contact form, but with validation. > So I thought, that I would use ActiveRecord for that, but it''s obvious > that I don''t want a table for that.Is it obvious? Do you want to save any of the info entered into the form?> > So the question is how to make such a form with validation in Rails3 > DRY way? > > I would be grateful for a piece of code for the controller and the > class itself.I believe you just need to use ActiveModel without the rest of ActiveRecord.> > Thanks.Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Lucas Mazza
2010-Dec-29 16:23 UTC
Re: Re: Simple Contact Form - ActiveRecord without a table
You can use the mail_form <https://github.com/plataformatec/mail_form> gem - it''s built on top of ActiveModel, so it acts like pretty similar to ActiveRecord models :) 2010/12/29 Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>> wardenik wrote in post #971297: > > Hey, > > > > This is hopefully a very basic question, though I couldn''t find a nice > > tutorial for that. > > I want to make in Rails3 a simple contact form, but with validation. > > So I thought, that I would use ActiveRecord for that, but it''s obvious > > that I don''t want a table for that. > > Is it obvious? Do you want to save any of the info entered into the > form? > > > > > So the question is how to make such a form with validation in Rails3 > > DRY way? > > > > I would be grateful for a piece of code for the controller and the > > class itself. > > I believe you just need to use ActiveModel without the rest of > ActiveRecord. > > > > > Thanks. > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > Sent from my iPhone > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Wed, Dec 29, 2010 at 9:26 AM, wardenik <radek.antoniuk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey, > > This is hopefully a very basic question, though I couldn''t find a nice > tutorial for that. > I want to make in Rails3 a simple contact form, but with validation. > So I thought, that I would use ActiveRecord for that, but it''s obvious > that I don''t want a table for that. > > So the question is how to make such a form with validation in Rails3 > DRY way? >This is what you want: watch this: http://railscasts.com/episodes/219-active-model ... this is the Rails 3 way of doing this ( if you are sure you don''t want to save the data). There was a more hacky way in Rails 2.> > I would be grateful for a piece of code for the controller and the > class itself. > > Thanks. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.