Rails 3.2.8にアップグレードした後、Rails 3.2.6でマス割り当てを渡すプライベートメソッドはパスしなくなり、マス割り当てエラーが発生し続けます。
私のコントローラーは
class AddressesController < BaseController
# GET /addresses
# GET /addresses.json
def index
@address = Address.new
form_info
respond_to do |format|
format.html # index.html.erb
format.json { render json: @addresses }
end
end
# GET /addresses/1
# GET /addresses/1.json
def show
@address = Address.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @address }
end
end
# GET /addresses/new
# GET /addresses/new.json
def new
@address = Address.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @address }
end
end
# GET /addresses/1/edit
def edit
@address = Address.find(params[:id])
end
# POST /addresses
# POST /addresses.json
def create
if params[:address].present?
@address = current_user.addresses.new(params[:address])
@address.default = true if current_user.default_shipping_address.nil?
@address.save_default_address(current_user, params[:address])
elsif params[:address_id].present?
@address = current_user.addresses.find(params[:address_id])
end
respond_to do |format|
if @address.id
update_order_address_id(@address.id)
format.html { redirect_to(orders_url, :notice => 'Address was successfully created.') }
else
form_info
format.html { render :action => "index" }
end
end
end
# PUT /addresses/1
# PUT /addresses/1.json
def update
@address = Address.find(params[:id])
respond_to do |format|
if @address.update_attributes(params[:address])
format.html { redirect_to @address, notice: 'Address was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @address.errors, status: :unprocessable_entity }
end
end
end
# DELETE /addresses/1
# DELETE /addresses/1.json
def destroy
@address = Address.find(params[:id])
@address.destroy
respond_to do |format|
format.html { redirect_to addresses_url }
format.json { head :no_content }
end
end
private
def update_order_address_id(id)
session_order.update_attributes(
:address_id => id
)
end
def form_info
@addresses = current_user.addresses
end
end
アドレスを作成した後、メソッドを実行することを期待していますupdate_order_address_id(id)
が、それは私に言い続けます
Can't mass-assign protected attributes: address_id
これはすべて、rails3.2.8にアップグレードした後に始まりました。誰かが私がこれを修正する方法を知っていますか、またはこれに向けた提案がありますか?