Thanks to all for the advice.  The slate_option thing works
nicely, and I should have thought of it myself.

However, I guess I still have two questions:

Why does select-one-editor behave rather differently to
the select-one tag, in regard to options?
 Is it oversight or have I missed something?

How do I get the list to reload upon change so the page
listing reflects the change?  Setting the update=id property
(where the id is that of the containing table-plus),
on the select-one-editor appears to break the control.

Mike

On Sep 11, 2:09 pm, Henry Baragar <[email protected]>
wrote:
> On September 10, 2010 04:05:32 pm kevinpfromnm wrote:
>
> > You could also move this to the model since it's not really view code
> > and then you don't have to make it depend on the choice of instance
> > variable.
>
> I am a little bit confused.  Where else in the application would this method
> be used, other than the controller?
>
> I would have thought that it should be placed in the viewhints file (unless it
> could go into a helpers file).
>
> Regards,
> Henry
>
>
>
> > def slate_options
> >   �...@slate_options ||= self.shoot.slates.map {|slate| [slate.name,
> > slate.id]}
> > end
>
> > On Sep 10, 6:43 am, François Beausoleil
>
> > <[email protected]> wrote:
> > > 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
>
> --
> Henry Baragar
> Instantiated Software

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