so you want D to be used only once for a given A-B set? or is it really only 1 relationship between any given A and B at most?
question is whether it's unique on just A_id and B_id OR A_id, B_id and D_id if it's fully unique, you'll need to change your data structure (well, it's the fastest way to get what you want) to reflect the real purpose of the data. A would then belong_to B and D or B would belong_to A and D or something like that. On Jul 7, 5:57 pm, Ronbo <[email protected]> wrote: > Yes - A - B is a has many/has many relationship > but D is a single attribute describing the relationship between A and > B > > On Jul 7, 6:52 pm, kevinpfromnm <[email protected]> wrote: > > > > > So, A should only be able to have one join to B/D in effect? > > > On Jul 7, 4:48 pm, Ronbo <[email protected]> wrote: > > > > Thanks Kevin - that works, but I think I misspoke. The attribute is > > > actually a selection on a separate table. So I can do the following > > > and it works. > > > > class A > > > has_many AB > > > has_many B, :through AB > > > has_many D, :through => AB, :accessible => true > > > > class AB > > > belongs_to A > > > belongs_to B > > > belongs_to D > > > > class B > > > has_many AB > > > has_many A, :through AB > > > > class D # this is the pick list. I want to store the selection on the > > > join > > > has_many AB > > > has_many A, :through => AB > > > > problem is that this results in an additive list, where users can keep > > > making selections. What I need is a regular drop down, where they can > > > only make one selection. My reading about accessible => true, is that > > > it does not work on a has_one. Is this something I could force in the > > > view? > > > > On Jul 7, 2:02 pm, kevinpfromnm <[email protected]> wrote: > > > > > sounds like you have something like this: > > > > class A > > > > has_many AB > > > > has_many B, :through AB > > > > > class AB > > > > some fields here > > > > belongs_to A > > > > belongs_to B > > > > > class B > > > > has_many AB > > > > has_many A, :through AB > > > > > you want the :accessible => true on the join association, like > > > > has_many AB, :accessible => true. see if that gets what you need or > > > > at least close. > > > > On Jul 6, 4:53 am, Ronbo <[email protected]> wrote:> Hi all, > > > > > > I've looked around for a recipe to do this and come up empty so far. > > > > > > I have a scenario where I need to allow users to set an attribute of a > > > > > many to many relationship. This is not an attribute of model A or > > > > > model B, but specific to each association. So I'm assuming it belongs > > > > > on the join table. The issue I have is how to expose that field to the > > > > > view of the page where users will make/update associations. > > > > > > Any suggestions are greatly appreciated. -- 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.
