passing get parameters through named route and then to controller model; stringify_keys!

Posted by user368937 on Stack Overflow See other posts from Stack Overflow or by user368937
Published on 2010-06-17T04:55:49Z Indexed on 2010/06/17 5:03 UTC
Read the original article Hit count: 188

Filed under:

Hey, I'm just learning ruby on rails and I've been stumped on this for awhile now.

Here's my url request:

  http://192.168.2.20:8080/Location/new/123.123,-123.123/

Here's my routes.rb:

  map.connect '/Location/new/:coords/', :controller => 'Location', :action => 'new', :coords => /\d+.\d+,-\d+.\d+/
  map.connect '/Location/list/', :controller => 'Location', :action => 'list'
  map.connect '/Location/create/', :controller => 'Location', :action => 'create'

Here's my location_controller.rb

  def new
    @coords = Location.new(params[:coords])
  end

Here's the error message it gives me:

  NoMethodError in LocationController#new
  undefined method `stringify_keys!' for "123.123,-123.123":String

© Stack Overflow or respective owner

Related posts about ruby-on-rails