Small change to Hobo models that makes <name-one> a bit easier.
One of the advantages of declaring :accessible => true on a
belongs_to, is that it allows you to set the target by name:
recipe.update_attributes :user => "Tom"
(that normally happens behind the scenes during a PUT or POST)
I've just made it so that you can do that even when :accessible =>
true is not declared. The reason being that changing a target of a
belongs_to is not actually a "multi-model" operation, in that the fkey
is on the owner (the recipe in that example). That is, it's just the
same as:
recipe.update_attributes :user_id => User.named('Tom').id
Which does not require :accessible => true.
This has removed an asymmetry between <select-one> and <name-one>.
<select-one> (which uses the foreign key) does not require :accessible
=> true, whereas <name-one> did (before this change). With this change
you can just replace the <select-one> with <name-one>.
Remember to add the 'autocomplete' declaration to the controller for
the target model
Useful tip: say you know there are hundreds and hundreds of a the
target model in your app, so you never want the default <select-one>
to be used (which has to fetch them ALL from the DB). You can tell
Hobo to use <name-one> throughout the app with:
<def tag="input" for="Recipe"><name-one/></def>
Tom
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---