Strong parameters for Block
This commit is contained in:
parent
a0a9f01be1
commit
509a407286
2 changed files with 7 additions and 1 deletions
|
|
@ -4,7 +4,7 @@ class BlocksController < ApplicationController
|
||||||
respond_to :html, :json
|
respond_to :html, :json
|
||||||
|
|
||||||
def create
|
def create
|
||||||
block = current_user.blocks.new(params[:block])
|
block = current_user.blocks.new(block_params)
|
||||||
|
|
||||||
if block.save
|
if block.save
|
||||||
disconnect_if_contact(block.person)
|
disconnect_if_contact(block.person)
|
||||||
|
|
@ -39,4 +39,8 @@ class BlocksController < ApplicationController
|
||||||
current_user.disconnect(contact, :force => true)
|
current_user.disconnect(contact, :force => true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def block_params
|
||||||
|
params.require(:block).permit(:person_id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
class Block < ActiveRecord::Base
|
class Block < ActiveRecord::Base
|
||||||
|
include ActiveModel::ForbiddenAttributesProtection
|
||||||
|
|
||||||
belongs_to :person
|
belongs_to :person
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue