Module: AuthorizedRailsScaffolds::Macros::AttributeMacros
- Included in:
- RSpecScaffoldViewHelper
- Defined in:
- lib/authorized_rails_scaffolds/macros/attribute_macros.rb
Overview
requires attributes to be defined
Instance Method Summary collapse
- #datetime_attributes ⇒ Object
- #output_attributes ⇒ Object
- #references_attributes ⇒ Object
- #standard_attributes ⇒ Object
Instance Method Details
#datetime_attributes ⇒ Object
30 31 32 |
# File 'lib/authorized_rails_scaffolds/macros/attribute_macros.rb', line 30 def datetime_attributes @datetime_attributes ||= output_attributes.reject{|attribute| ![:time, :date, :datetime].include? attribute.type } end |
#output_attributes ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/authorized_rails_scaffolds/macros/attribute_macros.rb', line 6 def output_attributes unless @output_attributes @output_attributes = [] # First attribute @output_attributes << attributes.first unless attributes.empty? # Reference Attribtues @output_attributes += attributes[1..-1].reject{|attribute| ![:references].include? attribute.type } # Standard Attributes @output_attributes += attributes[1..-1].reject{|attribute| [:references].include? attribute.type } end @output_attributes end |
#references_attributes ⇒ Object
22 23 24 |
# File 'lib/authorized_rails_scaffolds/macros/attribute_macros.rb', line 22 def references_attributes @references_attributes ||= output_attributes.reject{|attribute| ![:references].include? attribute.type } end |
#standard_attributes ⇒ Object
26 27 28 |
# File 'lib/authorized_rails_scaffolds/macros/attribute_macros.rb', line 26 def standard_attributes @standard_attributes ||= output_attributes.reject{|attribute| [:time, :date, :datetime, :references].include? attribute.type } end |