I want to have a field in model, which I''m not storing in a database. And I want to do something like the following in the model code : validates_format_of :field_NOT_in_db, :with => session[:field] How can I do it ? Thanks, Pratik -- rm -rf / 2>/dev/null - http://null.in
You might want attr_accessor? http://www.phylomortis.com/resource/script/syntax/syn-aa.html ------------- Timothy Johnson www.foundinteractive.com On Jun 25, 2006, at 6:51 PM, Pratik wrote:> I want to have a field in model, which I''m not storing in a database. > And I want to do something like the following in the model code : > > validates_format_of :field_NOT_in_db, :with => session[:field] > > How can I do it ? > > Thanks, > Pratik > -- > rm -rf / 2>/dev/null - http://null.in > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Hi there, You may (or may not) also need to look into these articles which I found useful : Validating Non-AR objects.. http://www.realityforge.org/articles/2005/12/02/validations-for-non-activerecord-model-objects and http://wiki.rubyonrails.com/rails/pages/HowToUseValidationsWithoutExtendingActiveRecord Best Regards Eaden McKee -- Webforce Ltd | www.webforce.co.nz On 6/26/06, Timothy Johnson <found@foundinteractive.com> wrote:> You might want attr_accessor? > > http://www.phylomortis.com/resource/script/syntax/syn-aa.html > > ------------- > Timothy Johnson > www.foundinteractive.com > > > > On Jun 25, 2006, at 6:51 PM, Pratik wrote: > > > I want to have a field in model, which I''m not storing in a database. > > And I want to do something like the following in the model code : > > > > validates_format_of :field_NOT_in_db, :with => session[:field] > > > > How can I do it ? > > > > Thanks, > > Pratik > > -- > > rm -rf / 2>/dev/null - http://null.in > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Simply, the agile book shows you how to create a simple login. You have a field password in the view that gets input into the model. you use attr_accessor to tell the Model that it should allow that value to be passed into the Instance, but then you encrypt the password and store it in the DB as column "hashed_password". It couldn''t be simpler really. ------------- Timothy Johnson www.foundinteractive.com On Jun 25, 2006, at 8:10 PM, Eaden McKee wrote:> Hi there, > You may (or may not) also need to look into these articles which I > found useful : Validating Non-AR objects.. > http://www.realityforge.org/articles/2005/12/02/validations-for-non- > activerecord-model-objects > and > http://wiki.rubyonrails.com/rails/pages/ > HowToUseValidationsWithoutExtendingActiveRecord > > > Best Regards > Eaden McKee > -- > Webforce Ltd | www.webforce.co.nz > > On 6/26/06, Timothy Johnson <found@foundinteractive.com> wrote: >> You might want attr_accessor? >> >> http://www.phylomortis.com/resource/script/syntax/syn-aa.html >> >> ------------- >> Timothy Johnson >> www.foundinteractive.com >> >> >> >> On Jun 25, 2006, at 6:51 PM, Pratik wrote: >> >> > I want to have a field in model, which I''m not storing in a >> database. >> > And I want to do something like the following in the model code : >> > >> > validates_format_of :field_NOT_in_db, :with => session[:field] >> > >> > How can I do it ? >> > >> > Thanks, >> > Pratik >> > -- >> > rm -rf / 2>/dev/null - http://null.in >> > _______________________________________________ >> > Rails mailing list >> > Rails@lists.rubyonrails.org >> > http://lists.rubyonrails.org/mailman/listinfo/rails >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails