Skip to content

icecold21/actionfield

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ActionField

Call actions on ActiveRecord fields before update or create.

Usage

Simple

  action_field strip: [:first_name, :last_name]

The above code will call strip method on first_name, and last_name to field before update or create.

More granular callback control

  action_field strip: [:first_name, :last_name], on: [:create]

The above code will call strip method on first_name, and last_name to field before create.

License

The code is on MIT license, feel free to use it or fork it. Or even send me a PR.