Hi, I just published the first version of a small tutorial I''ve written on Ajax and Rails. It is called "How to paginate, sort and search a table with Ajax and Rails" (sorry, I didn''t manage to find a longer title !) and is available at : http://dev.nozav.org/rails_ajax_table.html There is nothing really new in it, it''s rather a compilation and adaptation of several Rails wiki pages. As I am neither a Rails expert nor a native english speaker, I would greatly appreciate any feedback. Thanks, Julien -- Posted via http://www.ruby-forum.com/.
Julien Barnier wrote:> Hi, > > I just published the first version of a small tutorial I''ve written on > Ajax and Rails. It is called "How to paginate, sort and search a table > with Ajax and Rails" (sorry, I didn''t manage to find a longer title !) > and is available at : > > http://dev.nozav.org/rails_ajax_table.html > > There is nothing really new in it, it''s rather a compilation and > adaptation of several Rails wiki pages. > > As I am neither a Rails expert nor a native english speaker, I would > greatly appreciate any feedback. > > Thanks, > > JulienThanks Julien, I just did a quick glance but it looks really promising. Great explanations of theory and code. Keep those tutorials coming! -- Posted via http://www.ruby-forum.com/.
Thanks, Julien. It looks good. More stuff like this is needed. I''ll try it out in an app I''m working on and see how it goes, and offer any feedback. It would be nice to put a link to it on the Rails wiki if you haven''t already. That way people can more easily find it. On 5/6/06, Julien Barnier <julien@nozav.org> wrote:> > Hi, > > I just published the first version of a small tutorial I''ve written on > Ajax and Rails. It is called "How to paginate, sort and search a table > with Ajax and Rails" (sorry, I didn''t manage to find a longer title !) > and is available at : > > http://dev.nozav.org/rails_ajax_table.html > > There is nothing really new in it, it''s rather a compilation and > adaptation of several Rails wiki pages. > > As I am neither a Rails expert nor a native english speaker, I would > greatly appreciate any feedback. > > Thanks, > > Julien > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- "Impossible is nothing." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060506/d6095317/attachment.html
i tried this (by cut and paste) and gets this (http://localhost:3000/item/list): ActiveRecord::StatementInvalid in Item#list Mysql::Error: Unknown column ''conditions'' in ''where clause'': SELECT COUNT(*) FROM items WHERE (conditions) RAILS_ROOT: script/../config/.. Application Trace | Framework Trace | Full Trace ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:88:in `log'' ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:180:in `execute'' ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:322:in `select'' ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:175:in `select_one'' ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:16:in `select_value'' ./script/../config/../vendor/rails/activerecord/lib/active_record/base.rb:518:in `count_by_sql'' ./script/../config/../vendor/rails/activerecord/lib/active_record/base.rb:511:in `count'' ./script/../config/../app/controllers/item_controller.rb:18:in `list'' ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:88:in `log'' ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:180:in `execute'' ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:322:in `select'' ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:175:in `select_one'' ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:16:in `select_value'' ./script/../config/../vendor/rails/activerecord/lib/active_record/base.rb:518:in `count_by_sql'' ./script/../config/../vendor/rails/activerecord/lib/active_record/base.rb:511:in `count'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/base.rb:853:in `perform_action_without_filters'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/filters.rb:332:in `perform_action_without_benchmark'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/rescue.rb:82:in `perform_action'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/base.rb:369:in `process_without_session_management_support'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/session_management.rb:116:in `process'' ./script/../config/../vendor/rails/railties/lib/dispatcher.rb:38:in `dispatch'' ./script/../config/../vendor/rails/railties/lib/webrick_server.rb:117:in `handle_dispatch'' ./script/../config/../vendor/rails/railties/lib/webrick_server.rb:83:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'' ./script/../config/../vendor/rails/railties/lib/webrick_server.rb:69:in `dispatch'' ./script/../config/../vendor/rails/railties/lib/commands/servers/webrick.rb:59 ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:214:in `require'' ./script/../config/../vendor/rails/railties/lib/commands/server.rb:28 ./script/server:3 ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:88:in `log'' ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:180:in `execute'' ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:322:in `select'' ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:175:in `select_one'' ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:16:in `select_value'' ./script/../config/../vendor/rails/activerecord/lib/active_record/base.rb:518:in `count_by_sql'' ./script/../config/../vendor/rails/activerecord/lib/active_record/base.rb:511:in `count'' ./script/../config/../app/controllers/item_controller.rb:18:in `list'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/base.rb:853:in `perform_action_without_filters'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/filters.rb:332:in `perform_action_without_benchmark'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/rescue.rb:82:in `perform_action'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/base.rb:369:in `process_without_session_management_support'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/session_management.rb:116:in `process'' ./script/../config/../vendor/rails/railties/lib/dispatcher.rb:38:in `dispatch'' ./script/../config/../vendor/rails/railties/lib/webrick_server.rb:117:in `handle_dispatch'' ./script/../config/../vendor/rails/railties/lib/webrick_server.rb:83:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'' ./script/../config/../vendor/rails/railties/lib/webrick_server.rb:69:in `dispatch'' ./script/../config/../vendor/rails/railties/lib/commands/servers/webrick.rb:59 ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:214:in `require'' ./script/../config/../vendor/rails/railties/lib/commands/server.rb:28 ./script/server:3 Request Parameters: None Show session dump --- flash: !map:ActionController::Flash::FlashHash {} Response Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} -- Posted via http://www.ruby-forum.com/.
Hi,> Mysql::Error: Unknown column ''conditions'' in ''where clause'': SELECT > COUNT(*) FROM items WHERE (conditions)That is a bit strange. I just tried to reproduce it here by using Mysql as database, but it works for me. The error is as the code didn''t interpolate the "conditions" variables in the item controller. Are you sure you have the following syntax in item_controller.rb ? conditions = "name LIKE ''%#{@params[:query]}%''" unless @params[:query].nil? @total = Item.count(:conditions => conditions) @items_pages, @items = paginate :items, :order => sort, :conditions => conditions, :per_page => items_per_page Or maybe you could try with sqlite, but I don''t think the problem comes from the database used... Thanks for the feedback, Julien -- Posted via http://www.ruby-forum.com/.
Julien Barnier wrote:> > The error is as the code didn''t interpolate the "conditions" variables > in the item controller. Are you sure you have the following syntax in > item_controller.rb ? > > conditions = "name LIKE ''%#{@params[:query]}%''" unless > @params[:query].nil? > @total = Item.count(:conditions => conditions) > @items_pages, @items = paginate :items, :order => sort, :conditions => > conditions, :per_page => items_per_page >yes. i have exactly those code in item_controller.rb . im using rails 1.0, ruby 1.8.4, mysql 5.0.x, ubuntu dapper beta. -- Posted via http://www.ruby-forum.com/.
Hi,> yes. i have exactly those code in item_controller.rb . im using rails > 1.0, ruby 1.8.4, mysql 5.0.x, ubuntu dapper beta.Hmmm... Maybe you could try with a query parameter in your request, for example : http://localhost:3000/itm/list/?query=a Or maybe you could replace he ''conditions'' variable with ''@conditions'' ? -- Posted via http://www.ruby-forum.com/.
Julien Barnier wrote:> Hi,> > http://localhost:3000/itm/list/?query=aif i try that, here''s the error: Mysql::Error: Unknown column ''conditionsname'' in ''where clause'': SELECT COUNT(*) FROM items WHERE (conditionsname LIKE ''%a%'') the word ''conditions'' seems to be stucked.> > Or maybe you could replace he ''conditions'' variable with ''@conditions'' ?if i do this, i get the same error as before: Mysql::Error: Unknown column ''conditions'' in ''where clause'': SELECT COUNT(*) FROM items WHERE (conditions) -- Posted via http://www.ruby-forum.com/.