Last active
October 16, 2019 21:53
-
-
Save covard/5871583 to your computer and use it in GitHub Desktop.
Using ActiveRecord (> 4.0) outside of Rails. Since you can't use attar_accessible anymore you have to do it like this.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# when using ActiveDirectory outside of rails need to do it like this for ActiveRecord 4.0 | |
require 'action_controller' | |
raw_parameters = { :email => "[email protected]", :name => "John", :admin => true } | |
parameters = ActionController::Parameters.new(raw_parameters) | |
user = User.create(parameters.permit(:name, :email)) | |
# Happy Rubying =) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment