In the code sample posted below, I am trying to allow the user of the page to filter out which projects should be displayed by user. I am able to successfully filter the results by manually modifying the parameters passed in the address bar. But when I click the Filter button on the page it does nothing at all. It should refresh the page with the new parameters being passed when the button is pressed. Any ideas as to why this happens? Do I need to add anything in my controller?
View:
= form_tag projects_path, :method => :get do
Include:
- @all_users.each do |user|
= user
= check_box_tag "users[#{user}]", 1, @all_users.include?(user), :id => "users_#{user}"
= submit_tag 'Filter', {:id => "users_submit"}
Console After Loading Main Page:
[2014-10-13 23:32:55] INFO WEBrick 1.3.1
[2014-10-13 23:32:55] INFO ruby 1.9.3 (2013-06-27) [i686-linux]
[2014-10-13 23:32:55] INFO WEBrick::HTTPServer#start: pid=2718 port=3000
Started GET "/projects" for 127.0.0.1 at 2014-10-13 23:32:58 -0300
Connecting to database specified by database.yml
Processing by ProjectsController#index as HTML
Project Load (0.2ms) SELECT DISTINCT user FROM "projects"
Redirected to http://localhost:3000/projects?users%5BCoulson%5D=1&users%5BFitz%5D=1&users%5BMay%5D=1&users%5BSimmons%5D=1&users%5BWard%5D=1
Project Load (0.2ms) SELECT "projects".* FROM "projects" ORDER BY id
Completed 302 Found in 9ms (ActiveRecord: 0.4ms)
Started GET "/projects?users%5BCoulson%5D=1&users%5BFitz%5D=1&users%5BMay%5D=1&users%5BSimmons%5D=1&users%5BWard%5D=1" for 127.0.0.1 at 2014-10-13 23:32:59 -0300
Processing by ProjectsController#index as HTML
Parameters: {"users"=>{"Coulson"=>"1", "Fitz"=>"1", "May"=>"1", "Simmons"=>"1", "Ward"=>"1"}}
Project Load (0.2ms) SELECT DISTINCT user FROM "projects"
Project Load (0.2ms) SELECT "projects".* FROM "projects" ORDER BY id
Rendered projects/index.html.haml within layouts/application (11.8ms)
Completed 200 OK in 61ms (Views: 59.3ms | ActiveRecord: 0.4ms)
[2014-10-13 23:32:59] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2014-10-13 23:32:59 -0300
Served asset /jquery.js - 304 Not Modified (5ms)
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2014-10-13 23:32:59 -0300
Served asset /application.css - 304 Not Modified (1ms)
[2014-10-13 23:32:59] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
[2014-10-13 23:32:59] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2014-10-13 23:32:59 -0300
Served asset /application.js - 304 Not Modified (4ms)
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2014-10-13 23:32:59 -0300
Served asset /jquery_ujs.js - 304 Not Modified (1ms)
[2014-10-13 23:32:59] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
[2014-10-13 23:32:59] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
After clicking the submit button, nothing happens in the console, or does the browser seem to do anything. Rails 3.2.14 Ubuntu 12.04 LTS
Code was fixed with proper indentation: