find_instance is used to find an instance, ie a single venue. Your
index action wants to find multiple venues.
We haven't updated agility yet for 2.0. Hopefully that comes soon.
Here's a more idiomatic example that should work for you:
def index
hobo_index do
self.this = self.this.search(params[:search], :name) if params[:search]
self.this = self.this.order_by(parse_sort_param(:name,
:quantity)) if params[:sort]
index_response
end
end
I'm in the process of updating the controller manual page for Hobo 2.0
which should explain the benefits of structuring your code this way.
Bryan
On Wed, Nov 28, 2012 at 5:49 AM, tonym <[email protected]> wrote:
> HI All,
>
> I'm sure there's a simple solution to this, but I cannot figure it out.
> I have a table-plus, which works fine without the controller, but with the
> search controller it fails. Here's the table plus (with controller
> variable):
> ...
>
> <collection: replace>
> <table-plus with="&@venues" fields="&flist">
> ....
>
>
> With the following I get the error 'Couldn't find MyVenue without an ID'
>
> class MyVenuesController < ApplicationController
> hobo_model_controller
> auto_actions :all
>
> def index
>
> @my_venues = find_instance
> @venues = @my_venues.apply_scopes(:search => [params[:search],
> :name],
> :order_by => parse_sort_param(:name, :local_area, :status))
> end
> end
>
>
> the error is on the 'find_instance'. I assume this is something to do with
> me trying to get the table displayed on MyVenues index, but I don't
> understand why the id is missing when this is in the MyVenues model and
> controller.
>
> Cheers, Anthony.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/LIfugCRWSkwJ.
> 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.
--
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.