{"action":"created","issue":{"url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/issues/771","labels_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/issues/771/labels{/name}","comments_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/issues/771/comments","events_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/issues/771/events","html_url":"https://github.com/thoughtbot/shoulda-matchers/issues/771","id":101602132,"number":771,"title":"Permit fails for :update on 3.0.rc1","user":{"login":"AlexVPopov","id":3239252,"avatar_url":"https://avatars.githubusercontent.com/u/3239252?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexVPopov","html_url":"https://github.com/AlexVPopov","followers_url":"https://api.github.com/users/AlexVPopov/followers","following_url":"https://api.github.com/users/AlexVPopov/following{/other_user}","gists_url":"https://api.github.com/users/AlexVPopov/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexVPopov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexVPopov/subscriptions","organizations_url":"https://api.github.com/users/AlexVPopov/orgs","repos_url":"https://api.github.com/users/AlexVPopov/repos","events_url":"https://api.github.com/users/AlexVPopov/events{/privacy}","received_events_url":"https://api.github.com/users/AlexVPopov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/labels/Bug","name":"Bug","color":"e10c02"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/milestones/7","html_url":"https://github.com/thoughtbot/shoulda-matchers/milestones/3.0.0","labels_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/milestones/7/labels","id":928930,"number":7,"title":"3.0.0","description":"","creator":{"login":"mcmire","id":7371,"avatar_url":"https://avatars.githubusercontent.com/u/7371?v=3","gravatar_id":"","url":"https://api.github.com/users/mcmire","html_url":"https://github.com/mcmire","followers_url":"https://api.github.com/users/mcmire/followers","following_url":"https://api.github.com/users/mcmire/following{/other_user}","gists_url":"https://api.github.com/users/mcmire/gists{/gist_id}","starred_url":"https://api.github.com/users/mcmire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcmire/subscriptions","organizations_url":"https://api.github.com/users/mcmire/orgs","repos_url":"https://api.github.com/users/mcmire/repos","events_url":"https://api.github.com/users/mcmire/events{/privacy}","received_events_url":"https://api.github.com/users/mcmire/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":23,"state":"open","created_at":"2015-01-09T17:09:48Z","updated_at":"2015-09-30T04:10:05Z","due_on":null,"closed_at":null},"comments":10,"created_at":"2015-08-18T08:40:44Z","updated_at":"2015-09-30T14:55:03Z","closed_at":null,"body":"Hello, my setup is `shoulda-matchers` 3.0 rc1 and `rspec-rails` 3.3.3. The following test fails for me:\r\n```ruby\r\nit do\r\n  expense = Fabricate :expense\r\n  should permit(:amount, :date).for(\r\n    :update,\r\n    params:\r\n      {\r\n        id: expense.to_param,\r\n        expense: {tag_list: FFaker::Lorem.words(rand(1..3)).join(',')}\r\n      }\r\n  ).on(:expense)\r\nend\r\n```\r\nwith\r\n> Expected PATCH #update to restrict parameters  for :expenseto :amount and :date, but it did not restrict any parameters.\r\n\r\nHere are the relevant controller methods:\r\n```ruby\r\n\r\ndef create\r\n  @expense = Expense.new(expense_params)\r\n  @expense.user = current_user\r\n  current_user.tag(@expense, with: params[:expense][:tag_list], on: :tags)\r\n\r\n  if @expense.save\r\n    redirect_to expenses_path, notice: 'Expense was successfully created.'\r\n  else\r\n    flash[:error] = @expense.errors.full_messages.first\r\n    render :new\r\n  end\r\nend\r\n\r\ndef update\r\n  current_user.tag(@expense, with: params[:expense][:tag_list], on: :tags)\r\n\r\n  if @expense.update(expense_params)\r\n    redirect_to @expense, notice: 'Expense was successfully updated.'\r\n  else\r\n    render :edit\r\n  end\r\nend\r\n\r\ndef expense_params\r\n  params.require(:expense).permit(:amount, :date)\r\nend\r\n```\r\n\r\nTwo things:\r\n\r\n* a similar spec for the `create` action passes\r\n```ruby\r\nit do\r\n  should permit(:amount, :date).for(\r\n    :create,\r\n    params: {expense: {tag_list: FFaker::Lorem.words(rand(1..3)).join(',')}}\r\n  )\r\nend\r\n```\r\n* through `puts` statements in `update` and `expense_params` I determined, that in the failing spec the `update` action never gets called.\r\n\r\nCould this be a bug?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/issues/comments/144436966","html_url":"https://github.com/thoughtbot/shoulda-matchers/issues/771#issuecomment-144436966","issue_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/issues/771","id":144436966,"user":{"login":"rickyc","id":111761,"avatar_url":"https://avatars.githubusercontent.com/u/111761?v=3","gravatar_id":"","url":"https://api.github.com/users/rickyc","html_url":"https://github.com/rickyc","followers_url":"https://api.github.com/users/rickyc/followers","following_url":"https://api.github.com/users/rickyc/following{/other_user}","gists_url":"https://api.github.com/users/rickyc/gists{/gist_id}","starred_url":"https://api.github.com/users/rickyc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickyc/subscriptions","organizations_url":"https://api.github.com/users/rickyc/orgs","repos_url":"https://api.github.com/users/rickyc/repos","events_url":"https://api.github.com/users/rickyc/events{/privacy}","received_events_url":"https://api.github.com/users/rickyc/received_events","type":"User","site_admin":false},"created_at":"2015-09-30T14:55:03Z","updated_at":"2015-09-30T14:55:03Z","body":"Updated to the latest and previously failed permit specs work for me now :+1: "}}