spree-contrib / spree_contact_us

Adds Contact Us form to your Spree Commerce store
https://guides.spreecommerce.org
BSD 3-Clause "New" or "Revised" License
40 stars 138 forks source link

You should not use the `match` m ethod in your router without specifying an HTTP method #49

Closed ping0xFF closed 9 years ago

ping0xFF commented 9 years ago

I'm using rails 4.0.13 and spree 2-2-stable, and was getting the below error. I changed 'match' to 'get' in /home/dan/.rvm/gems/ruby-2.2.1@testapp/gems/spree_contact_us-1.1.0/config/routes.rb and I could run 'bundle exec rails g spree_contact_us:install' fine.

Since this is a rails 4 thing, would I commit a fix here? I'm not too sure how to help. Please advise.

/home/dan/.rvm/gems/ruby-2.2.1@testapp/gems/actionpack-4.0.13/lib/action_dispatch/routing/mapper.rb:191:in `normalize_conditions!': You should not use the `match` m
ethod in your router without specifying an HTTP method. (RuntimeError)
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"
        from /home/dan/.rvm/gems/ruby-2.2.1@testapp/gems/actionpack-4.0.13/lib/action_dispatch/routing/mapper.rb:67:in `initialize'
        from /home/dan/.rvm/gems/ruby-2.2.1@testapp/gems/actionpack-4.0.13/lib/action_dispatch/routing/mapper.rb:1482:in `new'
        from /home/dan/.rvm/gems/ruby-2.2.1@testapp/gems/actionpack-4.0.13/lib/action_dispatch/routing/mapper.rb:1482:in `add_route'
        from /home/dan/.rvm/gems/ruby-2.2.1@testapp/gems/actionpack-4.0.13/lib/action_dispatch/routing/mapper.rb:1461:in `decomposed_match'
        from /home/dan/.rvm/gems/ruby-2.2.1@testapp/gems/actionpack-4.0.13/lib/action_dispatch/routing/mapper.rb:1442:in `block in match'
        from /home/dan/.rvm/gems/ruby-2.2.1@testapp/gems/actionpack-4.0.13/lib/action_dispatch/routing/mapper.rb:1433:in `each'
        from /home/dan/.rvm/gems/ruby-2.2.1@testapp/gems/actionpack-4.0.13/lib/action_dispatch/routing/mapper.rb:1433:in `match'
        from /home/dan/.rvm/gems/ruby-2.2.1@testapp/gems/spree_contact_us-1.1.0/config/routes.rb:5:in `block in <top (required)>'
maximedelpit commented 9 years ago

Hi there,

I'm new to Spree and I get the same error when running rails s: /Users/apple/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/mapper.rb:238:inadd_request_method': 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" (ArgumentError)`

I'm running on spree 3.0.1 and rails 4.2.0 When using the edge version I have a conflict due to the dependency on spree 3.1.0 beta. at bundle install When using the stable version of spree_contact_us I got the issue above

Any idea of how solving this issue?

maximedelpit commented 9 years ago

Ok finally succeeded to use the gem by adding branch: 3-0-stable to my gemfile.

jspizziri commented 9 years ago

@maximedelpit , Unless your issue is related to @sybind's issue, please file it separately.

jspizziri commented 9 years ago

@sybind,

Did you get this issue when trying to run the install?

With that being said it sounds like it is an issue with how the routes are being defined and Rails ~> 4.0.12 not liking it. Could you submit a PR to 2-2-stable for the fix?

JDutil commented 9 years ago

This was fixed a long time ago by https://github.com/spree-contrib/spree_contact_us/commit/fb4147bfcd11ce0c5db682d84ed54da75e61269f I would make sure you guys are up to date I don't see match being used int he routes for 2-2-stable+ and probably even further back than that.

kinsomicrote commented 9 years ago

There seems to be an issue with this gem and the edge version of spree; 3.0.2 This error reported by @sybind gets displayed.

JDutil commented 9 years ago

If you read the routes file https://github.com/spree-contrib/spree_contact_us/blob/master/config/routes.rb you can see there are no uses of "match" because it was properly changed to "get" in this commit https://github.com/spree-contrib/spree_contact_us/commit/fb4147bfcd11ce0c5db682d84ed54da75e61269f#diff-21497849d8f00507c9c8dcaf6288b136L5 sorry I have no idea why your seeing the error, but if you figure it out feel free to submit a PR.

kinsomicrote commented 9 years ago

I think the ReadMe should be updated with possibly the latest stable version, I could send a PR if you dont mind. The issue was with version 1.0. I never knew there was a recent version till I did some digging. Guess the above persons fell into same trap.

JDutil commented 9 years ago

Please submit a PR thanks.