Module: Redmine::SafeAttributes::ClassMethods
- Defined in:
- lib/redmine/safe_attributes.rb
Instance Method Summary collapse
-
#safe_attributes(*args) ⇒ Object
Declares safe attributes An optional Proc can be given for conditional inclusion.
Instance Method Details
#safe_attributes(*args) ⇒ Object
Declares safe attributes An optional Proc can be given for conditional inclusion
Example:
safe_attributes 'title', 'pages'
safe_attributes 'isbn', :if => {|book, user| book.author == user}
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/redmine/safe_attributes.rb', line 31 def safe_attributes(*args) @safe_attributes ||= [] if args.empty? if superclass.include?(Redmine::SafeAttributes) @safe_attributes + superclass.safe_attributes else @safe_attributes end else = args.last.is_a?(Hash) ? args.pop : {} @safe_attributes << [args, ] end end |