Skip to content
This repository has been archived by the owner on Aug 17, 2017. It is now read-only.

Using ActiveSupport#on_load instead of send :include to boot. #144

Closed
wants to merge 1 commit into from

Conversation

kreeger
Copy link
Contributor

@kreeger kreeger commented May 21, 2013

This is similar to a pull request I made a while back on another project that included itself onto ActionController. In order for this to work on the rails-api gem, and other projects which may not use ActionController::Base, the method for including the ActionController::StrongParameters module should be changed.

# instead of...
ActionController::Base.send :include, ActionController::StrongParameters
# let's use...
ActiveSupport.on_load(:action_controller) { include ActionController::StrongParameters }

Also, it appears my editor has trimmed up some trailing whitespace in the rest of the file; let me know if that's a problem with this PR and I can change it.

@lowgravityday
Copy link

I'm new to rails and trying to deploy a rails-api api. I believe this may solve my issue of fields not being written to the DB, but I cannot figure out how to implement this. Could you give a few hints? Seen StackOverflow question: http://stackoverflow.com/questions/19871786/rails-api-post-params-being-set-to-null

@jeremy
Copy link
Member

jeremy commented Apr 26, 2014

👍

The whitespace changes are unrelated and make it difficult to see what exactly you changed. Please limit the change the just the relevant code.

@kreeger
Copy link
Contributor Author

kreeger commented Apr 26, 2014

@jeremy I can do that; let me close this PR and open a new one with only those changes.

@jeremy
Copy link
Member

jeremy commented Apr 28, 2014

(FYI, if you rebase your changes on your branch you can just git push -f and the pull request will automatically reflect the new commits ❤️)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants