Hi, I want to do validation on pages that send email. None of the fields are directly tied to any database table so it doesn''t seem to make sense to use the ActiveRecord::Base class but on the other hand I like the validation methods. What is the Rails way to do validation for such pages? Thanks, Frank
Nicholas Seckar
2005-Jun-02 00:15 UTC
Re: validation for form fields not tied to a db record?
Frank Kim wrote:>Hi, > >I want to do validation on pages that send email. None of the fields >are directly tied to any database table so it doesn''t seem to make >sense to use the ActiveRecord::Base class but on the other hand I like >the validation methods. What is the Rails way to do validation for >such pages? > >Typically this is done by hand. There have been many suggestions that validations should be factored out of AR into a reusable module, but nobody has done so yet. If you really wanted you could create a model object and just use valid? instead of save.
Trevor Squires
2005-Jun-02 01:54 UTC
Re: validation for form fields not tied to a db record?
I just updated the Wiki with info on how to do this. http://wiki.rubyonrails.com/rails/show/ HowToUseValidationsWithoutExtendingActiveRecord Hope it helps, Trevor On 1-Jun-05, at 5:15 PM, Nicholas Seckar wrote:> Frank Kim wrote: > >> Hi, >> >> I want to do validation on pages that send email. None of the fields >> are directly tied to any database table so it doesn''t seem to make >> sense to use the ActiveRecord::Base class but on the other hand I like >> the validation methods. What is the Rails way to do validation for >> such pages? >> > Typically this is done by hand. There have been many suggestions that > validations should be factored out of AR into a reusable module, but > nobody has done so yet. If you really wanted you could create a model > object and just use valid? instead of save. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Michael Campbell
2005-Jun-02 12:53 UTC
Re: validation for form fields not tied to a db record?
email friendly version of the same link: http://tinyurl.com/cpptt On 6/1/05, Trevor Squires <trevor-k8q5a0yEZAgS+FvcfC7Uqw@public.gmane.org> wrote:> > I just updated the Wiki with info on how to do this. > > http://wiki.rubyonrails.com/rails/show/ > HowToUseValidationsWithoutExtendingActiveRecord > > Hope it helps, > Trevor > > On 1-Jun-05, at 5:15 PM, Nicholas Seckar wrote: > > > Frank Kim wrote: > > > >> Hi, > >> > >> I want to do validation on pages that send email. None of the fields > >> are directly tied to any database table so it doesn''t seem to make > >> sense to use the ActiveRecord::Base class but on the other hand I like > >> the validation methods. What is the Rails way to do validation for > >> such pages? > >> > > Typically this is done by hand. There have been many suggestions that > > validations should be factored out of AR into a reusable module, but > > nobody has done so yet. If you really wanted you could create a model > > object and just use valid? instead of save. > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Stanislav Karchebny
2005-Jun-02 13:07 UTC
Re: validation for form fields not tied to a db record?
On Thursday 02 June 2005 15:53, Michael Campbell wrote:> email friendly version of the same link: > > http://tinyurl.com/cpptt >I guess rails people should be more towards the rails-based url site =) http://qurl.net/fI woot! its even shorter =) (and that is i at the end not l, probably qurl should be made case-agnostic? i''ll CC the author) -- Best regards, Stanislav Karchebny Skype name: berkus Get skype for free from www.skype.com _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails