Module: Smailer::Compatibility
Instance Method Summary collapse
- #has_attr_accessible? ⇒ Boolean
- #rails_2? ⇒ Boolean
- #rails_3? ⇒ Boolean
- #rails_3_or_4? ⇒ Boolean
- #rails_4? ⇒ Boolean
- #save_without_validation(object) ⇒ Object
- #update_all(scope, fields, conditions) ⇒ Object
Instance Method Details
#has_attr_accessible? ⇒ Boolean
21 22 23 |
# File 'lib/smailer/compatibility.rb', line 21 def has_attr_accessible? rails_2? || rails_3? end |
#rails_2? ⇒ Boolean
5 6 7 |
# File 'lib/smailer/compatibility.rb', line 5 def rails_2? Rails::VERSION::MAJOR == 2 end |
#rails_3? ⇒ Boolean
9 10 11 |
# File 'lib/smailer/compatibility.rb', line 9 def rails_3? Rails::VERSION::MAJOR == 3 end |
#rails_3_or_4? ⇒ Boolean
17 18 19 |
# File 'lib/smailer/compatibility.rb', line 17 def rails_3_or_4? rails_3? || rails_4? end |
#rails_4? ⇒ Boolean
13 14 15 |
# File 'lib/smailer/compatibility.rb', line 13 def rails_4? Rails::VERSION::MAJOR == 4 end |
#save_without_validation(object) ⇒ Object
25 26 27 |
# File 'lib/smailer/compatibility.rb', line 25 def save_without_validation(object) rails_3_or_4? ? object.save(:validate => false) : object.save(false) end |
#update_all(scope, fields, conditions) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/smailer/compatibility.rb', line 29 def update_all(scope, fields, conditions) if rails_3_or_4? scope.where(conditions).update_all(fields) else scope.update_all(fields, conditions) end end |