.nil? I believe is the method you're looking for On May 21, 4:05 pm, tjg <[email protected]> wrote: > Hi, again. Still new to Hobo. > > I added an attribute accessor on a model to return a value formatted > to 3 decimal places. > > For a 'show' view on this object, the accessor works nicely. > > But when Hobo is rendering a view of this object's parent with an > inline edit form, and (I'm gathering) adding this field as a hidden > field, it's throwing a 'can't convert nil into Float' error. > > How do I check if this attribute is nil when it's being rendered as a > hidden field? > > fields do > name :string > instrument_no :float, :default => 0 > timestamps > end > > def instrument_no > if [condition to detect that attribute is not nil to go here!] > "%0.3f" % read_attribute(:instrument_no) > end > end > > Any pointers? > Tim > > -- > 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 > athttp://groups.google.com/group/hobousers?hl=en.
-- 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.
