Matt,

On August 9, 2010 11:31:23 am Matt Jones wrote:
> On Mon, Aug 9, 2010 at 10:46 AM, Henry Baragar
> 
> <[email protected]> wrote:
> > Hello,
> > 
> > I have a few questions about hobo_index_for and auto_actions_for:
> > 
> > How do you apply a scope to hobo_index_for? Specifically, how can I apply
> > the search criteria?
> 
> hobo_index_for takes a :scope parameter, which actually supports
> passing an arbitrary number of scopes with arguments. It works a lot
> like apply_scopes does.
> 
> :scope => [[:foo], [:bar, :arg1, :arg2], [:baz, :arg3]]
> 
> will wind up effectively working like:
> 
> ParentModel.find(params[:parent_id]).association.foo.bar(:arg1,
> 
> :arg2).baz(:arg3).paginate
> 
> This was added very late in the 1.0 process, so probably needs better
> documentation. It's also very hard to make it work if any of the
> scopes need to depend on the parent object.
> 

This sounds like a big bug.  Has it been reported as one?

> > I have two interesting index pages: index and index_with_conflicts. How
> > can I create an auto_actions_for using index_with_conflicts?
> 
> This is the one thing that was missing; there *should* be something
> like index_action_for or equivalent, but there isn't at present.
> You'll probably wind up having to add the route explicitly.
> 

OK.

> > Why does the new-link on the index_for_owner page not preset the owner
> > field (and possibly hide it)?
> 
> This is a bug; it was reported a while back and I just tripped over it
> myself last week. Check lighthouse for some notes.
> 

OK.

> Thanks,
> 

Now for the observation.  I had forgotten about the "auto_actions_for :owner, 
:index" (although I frequently use "auto_actions_for :owner, [:new, :create]") 
and coded the following into my owner model:

          show_action :possessions

          def participants
            hobo_show do
              hobo_index @conference.participants.apply_scopes(
                :search => [params[:search], :name, :affiliation, :country],
                :order_by       => parse_sort_param(:name, :affiliation)
              )
            end
          end

Then I used the <index-page>, with a fixed <new-link:>.  

Overall, this seems to be less code then using "auto_actions_for", but it 
looks like it might be a wash if the above mentioned bug was fixed.

Regards,
Henry





> --Matt Jones

-- 
Henry Baragar
Instantiated Software
416-907-8454 x42

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