Created
March 22, 2013 15:05
-
-
Save joxxoxo/5221954 to your computer and use it in GitHub Desktop.
to bypass mass-assignment in seeds
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
# to bypass mass-assignment | |
Dir[Rails.root.join('app/models/*')].each {|f| require_dependency f } | |
ActiveRecord::Base.descendants.each {|m| p m.name; m.attr_accessible(*m.attribute_names)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment