Map your slates to [name, id]:
this.shoot.slates.map {|s| [s.name, s.id]}
When I do that in my application, I write a helper method in my
controller:
class SlatesController < ApplicationController
helper_method :slate_options
private
def slate_options
@slate_options ||= @slate.shoot.slates.map {|slate|
[slate.name, slate.id]}
end
end
Note that in the controller I don't have access to "this", thus I've
used the original @slate instance directly.
Hope that helps!
François
On 9 sep, 09:42, "[email protected]" <[email protected]> wrote:
> Hi,
>
> I'm having trouble with the difference between select-one,
> which I can get to work, and select-one-editor, which I can't.
>
> In my (movie) app, I have models shoots, slates and takes.
>
> shoot
> has_many :slates
>
> slate
> has_many :takes
> belongs_to :shoot
>
> take
> belongs_to :slate
>
> To allow changing the slate of a take I have this in
> application.dryml
>
> <extend tag="form" for="Take">
> <old-form merge>
> <field-list: fields="description, downloaded, stills, movie, archived,
> image_sequence, slate, shoot">
> <slate-view:>
> <select-one options="&[email protected]"></select-one>
> </slate-view:>
> </field-list>
> </old-form>
> </extend>
>
> And this gives me a nice drop down, restricted to just those
> slates which belong to the same shoot.
>
> I also want an ajax'ed in-line-editor to do the same thing from the
> show slate pages, so I have this
> in slate/show.dryml
>
> <table-plus:takes fields="this, downloaded, slate, stills, movie,
> image_sequence, archived, raw_filename">
> .
> .
>
> <slate-view:>
> <select-one-editor options="&[email protected]"/>
> </slate-view>
>
> This presents, at first glance the same drop down in the table
> plus.
>
> However, his gives me two problems
>
> 1) The value of the select options is the name of the take, not its id
> and this on a save I get a slate id of 0.
> 2) When the drop down is changed, it doesn't actually trigger the
> save of the take and a refresh of the page is necessary.
>
> Any insights welcome.
>
> Mike
--
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.