Paramount
Take controll of your params in a dedicated Form Object
Installation
Add the following line to your application's Gemfile & bundle it!
gem 'paramount'
Usage
$ bin/rails g paramount Book
This will create a new file in app/forms
class BookForm < Paramount::Model
attribute :title
def assign
model.attributes= attributes #.except(:notify_me, :author_name, :geolocate, :etc)
# assign_association
end
private
def assign_association
# (model.author || model.build_author).name = author_name
end
end
Contributing
- Fork it ( https://github.com/charly/paramount/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request