Rails 4 doesn't like routes that start with match and don't have the HTTP method(s) specified. Maybe something you could change in the source code for future use. Is it only get or both get and post?
get '/rate' => 'rater#create', :as => 'rate' OR
match '/rate', to: 'rater#create', :as => 'rate', via: [:get, :post]'
Thx
migu at Laptop in ~/Projects/zookal-digital on master
$ rails g letsrate User
create app/assets/javascripts/jquery.raty.js
create app/assets/images/star-on.png
create app/assets/images/star-off.png
create app/assets/images/star-half.png
create app/assets/javascripts/letsrate.js.erb
create app/controllers/rater_controller.rb
create app/models/rate.rb
create app/models/rating_cache.rb
route match '/rate' => 'rater#create', :as => 'rate'
create db/migrate/20140102015045504_create_rating_caches.rb
create db/migrate/20140102015045505_create_rates.rb
migu at Laptop in ~/Projects/zookal-digital on master*
$ rake db:migrate
[RailsAdmin] RailsAdmin initialization disabled by default. Pass SKIP_RAILS_ADMIN_INITIALIZER=false if you need it.
rake aborted!
You should not use the `match` method in your router without specifying an HTTP method.
If you want to expose your action to both GET and POST, add `via: [:get, :post]` option.
If you want to expose your action to GET, use `get` in the router:
Instead of: match "controller#action"
Do: get "controller#action"
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:191:in `normalize_conditions!'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:67:in `initialize'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1443:in `new'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1443:in `add_route'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1422:in `decomposed_match'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1403:in `block in match'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1394:in `each'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1394:in `match'
/Users/migu/Projects/zookal-digital/config/routes.rb:2:in `block in <top (required)>'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `instance_exec'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `eval_block'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:319:in `draw'
/Users/migu/Projects/zookal-digital/config/routes.rb:1:in `<top (required)>'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `block in load'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `each'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `load_paths'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:16:in `reload!'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:26:in `block in updater'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in `call'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in `execute'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:27:in `updater'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/migu/Projects/zookal-digital/config/environment.rb:5:in `<top (required)>'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/application.rb:189:in `require_environment!'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/gems/railties-4.0.2/lib/rails/application.rb:250:in `block in run_tasks_blocks'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/bin/ruby_executable_hooks:15:in `eval'
/Users/migu/.rvm/gems/ruby-2.0.0-p247@zookal-digital/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Awesome gem, thanks for your hard work guys!
Rails 4 doesn't like routes that start with
match
and don't have the HTTP method(s) specified. Maybe something you could change in the source code for future use. Is it only get or both get and post?get '/rate' => 'rater#create', :as => 'rate'
ORmatch '/rate', to: 'rater#create', :as => 'rate', via: [:get, :post]'
Thx