On May 29, 4:43 pm, Bryan Larsen <[email protected]> wrote: > Fernando wrote: > > I've got a Person model, with one of its attributes being of the Money > > value class: > > > class Person < ActiveRecord::Base > > > hobo_model # Don't put anything above this > > > fields do > > field1 :string > > field2 :string > > credit_limit_amount :decimal, :precision => 10, :scale => > > 3, :default => 0 > > credit_limit_currency_id :integer > > field3 :string > > timestamps > > end > > > composed_of :credit_limit, :class_name => 'Money', :mapping => [%w > > (credit_limit_amount amount), %w(credit_limit_currency_id > > currency_id)] > > > end > > > I've redefined the view tag for money like this: > > > <def tag="view" for="Money"> > > <%= this.currency.symbol + ' ' + this.amount.to_s %> > > </def> > > > It shows perfectly on the Person show page. > > > The problem is with the Person edit form. The field does not show, nor > > does its label. > > It doesn't matter if I include it explicitly in field-list, or I > > redefine the > > input tag. > > I've never used composed_of. Didn't even know about it. Looks pretty cool. > > Until I get a chance to fix this for you, you can use an HTML input tag > without the hobo smarts by providing the type attribute. For example: > > <input type="text" name="#{param_name_for_this}[credit_limit]" /> > Thanks, I'll try that > > > Also, the /persons/new page says "The page you were looking for could > > not be found" > > even though auto_actions is :all and I'm logged in as admin. > > > Any clues as to why this is happening ? > > In the quoted code snippet, did you delete your permission functions or > are they missing?
I've omitted them for brevity. > cheers, > Bryan I was guessing Hobo wasn't aware of composed_of, mainly because when I first added the composed_of macro nothing showed up in hobo_migration. I had to declare the fields explicitly in the fields do ... end part. I don't know how easy would it be to integrate this in Hobo, mainly because you have to either modify composed_of to declare the column type for every 'subfield' or declare them in the fields do ... end part which doesn't seem all that right. Thanks for your help, --Fernando --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
