Hi William,

I think you missed defining the part. I just tried this (without
modifying the controller) to add Ajax pagination to a table plus in Hobo
2.0:

<index-page>
  <collection: replace>
  <div part="products">
    <table-plus update="products"
fields="name,body,updated_at"></table-plus>
  </div>
</collection:>
</index-page>

Could you try it? If it works, you can check the Agility tutorial to
enable the sorting.

Warm regards,
Ignacio

El 02/11/13 17:40, William Wong escribió:
> I spent a whole day trying to figure out how to add ajax magic
> (pagination, sorting..etc) to my table-plus. But, it's only giving me an
> "undefined method 'get' for #ActiveRecord. Can someone point me to the
> right direction? Something obvious must be wrong.Thanks.
> 
> 1. Error message
> Started GET "/products?page=2&render=none&_=1383409360860" for 127.0.0.1
> at 2013-11-03 00:22:44 +0800
> Processing by ProductsController#index as JS
>   Parameters: {"page"=>"2", "render"=>"none", "_"=>"1383409360860"}
>   Product Load (0.2ms)  SELECT "products".* FROM "products" LIMIT 30
> OFFSET 30
> Completed 500 Internal Server Error in 3ms
> 
> NoMethodError (undefined method `get' for
> #<ActiveRecord::Relation:0x007fb89bfc8c98>):
>   app/controllers/products_controller.rb:11:in `block (3 levels) in index'
>   app/controllers/products_controller.rb:9:in `block in index'
>   app/controllers/products_controller.rb:8:in `index'
> 
> (it's requesting a JS which means the ajax stuff is good but what is
> undefined method 'get'?)
> 
> 2. index.dryml
> 
> <index-page>
> <collection: replace>
> <table-plus update="products" fields="name,body,updated_at">
> </table-plus>
> </collection:>
> </index-page>
> 
> 3. products_controller.rb
> 
> class ProductsController < ApplicationController
> 
>   hobo_model_controller
> 
>   auto_actions :all
>   
>   def index
>     hobo_index do 
>       respond_to do |format|
>         format.html
>         format.js { hobo_ajax_response @products }
>       end
>     end
>   end
> end
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Ignacio Huerta Arteche
http://www.ihuerta.net
Teléfono: 0034 645 70 77 35
Email realizado con software libre

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to