ruby - ActiveRecord saving: differences in Rails 3.2.19 and Rails 4.2.0 -


i have 2 identical projects: rails 3.2.19 , updated rails 4.2.0beta4. when try foo.create! in rails 3.2 , rails 4.2 see diffirent queries in rails console log.

rails 3.2 output:

insert `foos` (`created_at`, `updated_at`, `column_1`,`column_2`, ...) values ('2014-11-19 11:20:28.391649', '2014-11-19 11:20:28.391649', null, null, ...) 

rails 4.2 output:

insert `foos` (`created_at`, `updated_at`) values ('2014-11-19 11:20:28.391649', 545662, '2014-11-19 11:20:28.391649') 

please explain why different rails versions execute different queries , why did so?

this related strong parameters enabled default in 4.x version. taking example documentation:

class peoplecontroller < actioncontroller::base   # raise activemodel::forbiddenattributes exception because it's using mass assignment   # without explicit permit step.   def create     person.create(params[:person])   end    # pass flying colors long there's person key in parameters, otherwise   # it'll raise actioncontroller::parametermissing exception, caught   # actioncontroller::base , turned 400 bad request reply.   def update     person = current_account.people.find(params[:id])     person.update_attributes!(person_params)     redirect_to person   end    private     # using private method encapsulate permissible parameters pattern     # since you'll able reuse same permit list between create , update. also,     # can specialize method per-user checking of permissible attributes.     def person_params       params.require(:person).permit(:name, :age)     end end 

in person_params method need allow parameters want changed.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -