The hobo trick you're looking for is :accessible => true on the model
association from the model that should be able to create/edit the
secondary model.

The tricky part is figuring out which part you want accessible.  Like,
if you have a group model and a join table to users (a
has_many :users, :through => :group_users), and you want the user form
to be able to select many groups, you set it on the join association.

User
  has_many :user_groups, :accessible => true  # this lets it create
new joins but not new groups
  has_many :groups, :through => :user_groups # if you put it here,
it'd let you create/destroy groups
...
end

UserGroup
  belongs_to :user
  belongs_to :group
...
end

Group
  has_many :user_groups
  has_many :users, :through => :user_groups
...
end

If you're having trouble with the view aspect, that's a different
question.  And if you're talking about some sort of ajax accessible
associations, I can't help there as I haven't done anything like that.

On Aug 21, 5:03 pm, Scorpio <[email protected]> wrote:
> I'm working on a products page and its all fine and dandy until I come
> to attributes and prices (different currencies ).
> I've been thinking of creating a separate resource Attribute and
> Price. I know how to set up the relations between Product and the two
> but what i don't know is how to merge the views of all 3 into one card
> so that if need be attributes and currencies can be set / updated in-
> line on the products page. With pure rails I can wrap my head about it
> but since I'm new to hobo I still feel a bit confused and lost in the
> way it creates the views and I haven't got a clue how to do the merge
> between two or more separate pages not to mention getting the restful
> actions from 3 places in one set of buttons.
>
> Yes I've read the Rapid Rails book from cover to cover and I might as
> well set the api/manual/cookbook page as my homepage (I did my
> homework). Yet I'm still lost. Just so we're clear I'm expecting
> pointers not the code handed to me on a silver plater. I like hobo and
> rails and I'd like to improve my skills but I've got now clue how to
> approach this.
>
> Just to clarify what I'd expect to be the end result (If you have a
> clear picture by now no need to read further)
>
> A standard Product page with some default fields like name,
> description etc and in that page a selectable list of attribute names -> if 
> selected an inline form shows up to populate the values of the
>
> attributes specific to the product and somewhere after all that a list
> of fields with available currencies so the price in each can be set.
> When the user clicks create / update I would like all 3 models to be
> updated
>
> Thanks in advance and sorry for asking so many questions. Taking in
> both Intermediate Ruby/Rails and Basic DRYML is just too much to fast
> but I'm in a bit of a pickle I cant get out of and I do not have the
> luxury of time.

-- 
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.

Reply via email to