how to use update_attributes in rails 4?

ruby-on-rails, ruby-on-rails-4, upgrade

Solution

Just use `@lease.update(lease_params)` this and also in the controller add a private method

def lease_params
  params.require(:lease).permit!
end

Problem

Currently I am upgrading my application from rails 3.2 to rails 4. Got the following error. ``` ArgumentError (argument out of range): ``` This error occured because of following line of code ``` @lease.update_attributes(params[:lease]) ``` I tried by update that also throw the same error. Is update_attributes removed from rails 4.how to use this? code: ``` def terms_build_methods if @lease.blank? @lease = params[:current_lease_id].present? ? Lease.find_by_id(params[:current_lease_id].to_i) : Lease.create(params[:lease]) else @lease.update(lease_params) end Lease.update_lease_occupancy_type(@lease) Lease.update_lease_status(@lease) end private def lease_params params.require(:lease).permit! end ```

Original source