I'm pretty sure all is in effect a blank value, so your default code
is getting run.  only thing I can think of is add a hidden input that
shows whether this is a first view or not.  then you can bypass your
default code when it's not the first view of the page.

On May 3, 9:58 am, storitel <[email protected]> wrote:
> hi Matt
>
> thanks for your input -
>
> I'm trying to filter so that by default only records belonging to
> current user get displayed. following your suggesion I've got...
>
>  :user_is => params[:user] || current_user
>
> this mostly works- the default list is filtered by current user, and i
> can select others from the the filter-menu... but now the All option
> is also filtered to show only the current-user records.
>
> any thoughts?
> paul
>
> On 3 May, 04:23, Matt Jones <[email protected]> wrote:
>
>
>
> > On May 2, 2010, at 3:06 AM, storitel wrote:
>
> > > hi all this must be an easy one ... i've got a <filter-menu> working,
> > > but I want to make it default to something other than All ... is there
> > > a simple trick for this or do I have to fully get my head around
> > > named_scopes? :-)
>
> > Depends - what do you mean by "default to something"? If you just want  
> > to change the *label* that says "All", you can use the no-filter param:
>
> >http://cookbook.hobocentral.net/api_tag_defs/filter-menu
>
> > On the other hand, if you want the actual value to default to  
> > something different, you can just fix it in the controller:
>
> > def index
> >    params[:some_filter_param] ||= 'some_value'
> >   ...
> > end
>
> > Assuming the definition matches up, you'll get the filter-menu set to  
> > the correct value whenever you don't pass in a param.
>
> > I use an identical trick to force a sort order on table-plus  
> > (especially when sorting records that belong_to :user).
>
> > --Matt Jones
>
> > --
> > 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 
> > athttp://groups.google.com/group/hobousers?hl=en.
>
> --
> 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 
> athttp://groups.google.com/group/hobousers?hl=en.

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