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
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
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
Webforce Ltd | www.webforce.co.nz
You might want attr_accessor?
http://www.phylomortis.com/resource/script/syntax/syn-aa.html
Timothy J.
www.foundinteractive.com
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 J.
www.foundinteractive.com
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs