Discussion Forums
- Topic List
- Most Recent Posts
- Sign In for more options
I have a simple form with just one field (auto_complete_text_field)
The parameters passed to my controller method are: Parameters: {"account"=>{"locations"=>"Canton"}, "action"=>"area_search", "authenticity_token"=>"85f47cc6b00aa9b06e4e06537c1b4bea17525a0c", "method"=>"get", "controller"=>"accounts"}
I'd like to use the "locations" parameter but it doesn't seems to be working in the params call: @account = Account.find_by_name(params[:locations])
Any ideas why or how I can access it?
Thanks!
Take a look at the params hash you posted. The key you want, "locations", is in a hash that is nested within the params hash. That nested hash is the value keyed by "account". So, you need to do this:
Account.find_by_name(params[:account][:locations])
