I think it's working ok - it might be just a data issue. Your code
worked ok for me on a HABTM. On has_many, by default, it only shows up
the has_many (targets in your case) that aren't assigned already (see
"orphaned", below). So if every "target" belongs to something then
none will show up in the unassigned list. Is that what you are seeing?
If you wanted them all to show up you could override this method.
Plenty of examples on the mailing list already.
# A useful override for customizing the records present in an
association dropdown.
# Should work in both the subform and form_ui=>:select modes.
# Check association.name to specialize the conditions per-
column.
def options_for_association_conditions(association)
return nil if association.options[:through]
case association.macro
when :has_one, :has_many
# Find only orphaned objects
"#{association.primary_key_name} IS NULL"
when :belongs_to, :has_and_belongs_to_many
# Find all
nil
end
end
Also using draggable with has_many means you can't add a new "target"
when you are editing whatever the main model is. And obviously a user
can easily remove it from a different instance to assign it to the
current one if you do the override. That's fine if that's what you
want. That's not typical of my has_many relationships. For those
reasons I would probably only use this with HABTM.
Regards,
Kerry
On Aug 18, 7:46 pm, mikev <[email protected]> wrote:
> Can someone provide or point to an example of using draggable_lists as
> described inhttp://wiki.github.com/activescaffold/active_scaffold/api-column?
> I tried the following and several other variations but it doesn't
> work:
>
> config.columns[:targets].form_ui = :select
> config.columns[:targets].options = {:draggable_lists => true}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---