Then put the :accessible => true on the join, not either of the
endpoints.

On Jul 8, 6:53 am, Ronbo <[email protected]> wrote:
> Thanks Kevin.
>
> This is getting closer.
>
> I have what I'm sure is a has_many to has_many relationship. Here is
> the situation:
>
> Users can create new docs.
>
> They can add boilerplate pieces from a library to the doc.
>
> Each doc also has 5 standard sections which can have about 14 standard
> subsections, and users can assign/reassign a piece to a section/
> subsection, so
>
> doc has_many :pieces
> piece has_many :docs
>
> what I want to do is let users choose which section and subsection of
> the doc  a piece belongs to. I think the place to store this info is
> the join - there may be a whole different approach I am not thinking
> of.
>
> doc_piece either has additional relationships with section and
> subsection models, or they could be field enums on doc_piece itself.
> I need to expose them as a couple of drop dowsn in the UI. Users can
> choose a (sub)section and later move the piece to another one, but the
> join relationship can only assign the piece to one section and
> subsection of the doc at a time.
>
> So really, I just need a way to expose the section and subsections to
> the user as simple selects.
>
> On Jul 7, 8:46 pm, kevinpfromnm <[email protected]> wrote:
>
>
>
> > sorry, read back a bit and think this says what I needed to know.
>
> > > 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?
>
> > this makes it sound like you don't really want a join table but
> > instead a belongs_to relationship (or two).  Unless you're mistaking
> > what this code is doing in the view:
>
> > > class A
> > > has_many AB
> > > has_many B, :through AB
> > > has_many D, :through => AB, :accessible => true
>
> > this tells it to allow class A to add D's through the AB join table.
> > each addition is not another D on a single link, but another AB join
> > (though B would be nil).  if you want there to be possible multiple
> > relationships for each A and B, but a selection for D, you want
> > the :accessible => true on the join table like this:
>
> > class A
> > has_many AB, :accessible => true # this will let A's form, create AB's
> > which will have the dropdown selectors for B and D
> > has_many B, :through => AB
> > has_many D, :through => AB # not accessible

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