hobo_model extends attr_accessor to carry a type attribute - it should do what you want.
Note that there's a bug in the handling of boolean types on current version - you may want to grab this commit: http://github.com/al2o3cr/hobo/commit/e5eeaf97155a53b5f46e193e4dd092f4bcf37440 to avoid some weird errors. --Matt Jones On Aug 24, 2009, at 4:14 PM, Timothy Hunt wrote: > Hi > > Is there a simple way to defined instance variables in a Hobo Model > that > are not persisted in the database, and only shown in edit forms. > > As an example, there's a need in an input form for an end-user to > communicate to the validation routines that they know they are doing > something stupid. Once validation is completed, there is no real > need to > store, or show, the flag. > > As an example, something like:- > > class Customer < ActiveRecord::Base > > hobo_model > > fields do > name :string > phone :string > phone_not_avail :boolean, default => false, :persist => false > email :string > email_not_avail :boolean, default => false, :persist => false > end > > validates_presence_of :phone, :unless => :phone_not_avail > validates_presence_of :email, :unless => :email_not_avail > > end > > Where "persist" might be the option to indicate that the field is > not to > be stored. > > I suspect the simplest work around is to just accept that these flags > will be stored in the database. > > I've only been using Hobo/Rails for a couple of months, so I apologize > if I missed something obvious in the documentation. > > Thanks > > Tim > > > > <tim.vcf> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
