Strong parameters for Block

This commit is contained in:
James Fleming 2013-06-27 16:32:33 +02:00 committed by Jonne Haß
parent a0a9f01be1
commit 509a407286
2 changed files with 7 additions and 1 deletions

View file

@ -4,7 +4,7 @@ class BlocksController < ApplicationController
respond_to :html, :json
def create
block = current_user.blocks.new(params[:block])
block = current_user.blocks.new(block_params)
if block.save
disconnect_if_contact(block.person)
@ -39,4 +39,8 @@ class BlocksController < ApplicationController
current_user.disconnect(contact, :force => true)
end
end
def block_params
params.require(:block).permit(:person_id)
end
end

View file

@ -1,4 +1,6 @@
class Block < ActiveRecord::Base
include ActiveModel::ForbiddenAttributesProtection
belongs_to :person
belongs_to :user