Skip to content

Commit

Permalink
Set up attribute whitelisting if you're using active record
Browse files Browse the repository at this point in the history
  • Loading branch information
Harold Giménez committed Oct 28, 2011
1 parent 70887f8 commit fcbe87c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/suspenders/app_builder.rb
Expand Up @@ -133,6 +133,10 @@ def setup_root_route
route "root :to => 'Clearance::Sessions#new'"
end

def set_active_record_whitelist_attributes
inject_into_class "config/application.rb", "Application", " config.active_record.whitelist_attributes = true\n"
end

def migrate_database
rake "db:migrate"
end
Expand Down
8 changes: 8 additions & 0 deletions lib/suspenders/generators/app_generator.rb
Expand Up @@ -28,6 +28,7 @@ def suspenders_customization
invoke :setup_gitignore
invoke :copy_miscellaneous_files
invoke :setup_root_route
invoke :set_active_record_whitelist_attributes
invoke :outro
end

Expand Down Expand Up @@ -101,6 +102,13 @@ def setup_root_route
build(:setup_root_route)
end

def set_active_record_whitelist_attributes
if 'active_record' == options[:orm]
say "Setting up active_record.whitelist_attributes"
build(:set_active_record_whitelist_attributes)
end
end

def outro
say "Congratulations! You just pulled our suspenders."
say "Remember to run 'rails generate airbrake' with your API key."
Expand Down

0 comments on commit fcbe87c

Please sign in to comment.