Skip to content

Instantly share code, notes, and snippets.

@joxxoxo
Created March 22, 2013 15:05
Show Gist options
  • Save joxxoxo/5221954 to your computer and use it in GitHub Desktop.
Save joxxoxo/5221954 to your computer and use it in GitHub Desktop.
to bypass mass-assignment in seeds
# 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