It's not that it has any use outside view/controller but it's also
still just the model data in a different format.  As to why to put it
in the model rather than the view/controller/viewhints is more
pragmatic as you don't have to add a private declaration or count on a
specific variable to be set.  Perhaps he'll have this editor in a
card, with multiple cards on a page.

Why does it have different options?  Don't know.  Might've been an
oversight when one or other set of tags was redesigned.  Probably
something related to point two below.

Getting the update to work would guess that it's not fully implemented
yet.  http://cookbook.hobocentral.net/api_taglibs/rapid_editing

"This area of Hobo has had less attention that the non-ajax forms of
late, so it’s lagging a little. There may be some rough edges. For
example, the tags in this library do not (yet!) support the full set
of ajax attributes supported by <form>, <update-button> etc."

On Sep 11, 7:09 am, 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