Daniel Thompson Daniel Thompson - 8 months ago 44
AngularJS Question

Rails: parameters visible in console but not accessible as params

I am sending a get request to the url:


In my rails server console I see the following:

Processing by GroupsController#show as JSON
Parameters: {"id"=>"11"}

But I have no access to the params object in this show controller method. The following:

puts "puts params!"
puts params

Puts nothing to the console:

puts params!
Completed 500 Internal Server Error in 2ms (ActiveRecord: 0.0ms)

NoMethodError (undefined method `id' for #<ActionController::Parameters:0x007f7f9c482bf0>):

My rails project is serving as an API for an angular ui-router frontend and I am using Devise for user management. What could be preventing my params from showing up in this method?

Answer Source

Are you calling id as a method on params? It probably should be params[:id] instead of params.id