Rails 3アプリケーションがあり、モデルの1つにフィールドを追加したいのですが、フィールドはlocalipに沿ったものと呼ばれます。
現在のローカルIPをフィールドに追加するにはどうすればよいですか?
コントローラの標準のcreateメソッドは次のようになります。
# POST /prescriptions
# POST /prescriptions.json
def create
@prescription = Prescription.new(params[:prescription])
respond_to do |format|
if @prescription.save
format.html { redirect_to @prescription, notice: 'Prescription was successfully created.' }
format.json { render json: @prescription, status: :created, location: @prescription }
else
format.html { render action: "new" }
format.json { render json: @prescription.errors, status: :unprocessable_entity }
end
end
end
createメソッドを使用して挿入する方法はありますか?