Module: Seofy::ActiveRecord::ClassMethods
- Defined in:
- lib/seofy/active_record.rb
Instance Method Summary collapse
- #for_seofy(param) ⇒ Object
- #for_seofy_with_short_url(param) ⇒ Object
- #init_seofy_config(options = {}) ⇒ Object
- #seofy(options = {}) ⇒ Object
- #seofy_adapter ⇒ Object
Instance Method Details
#for_seofy(param) ⇒ Object
20 21 22 |
# File 'lib/seofy/active_record.rb', line 20 def for_seofy(param) self.send("find_by_#{seofy_adapter.column}", param.split("-").last) end |
#for_seofy_with_short_url(param) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/seofy/active_record.rb', line 24 def for_seofy_with_short_url(param) if param.to_s.include?("-") for_seofy(param) else self.send("find_by_#{seofy_adapter.column}", param) end end |
#init_seofy_config(options = {}) ⇒ Object
11 12 13 14 |
# File 'lib/seofy/active_record.rb', line 11 def init_seofy_config(={}) class_attribute :seofy_config self.seofy_config = ::Seofy::Configuration.new() end |
#seofy(options = {}) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/seofy/active_record.rb', line 4 def seofy(={}) init_seofy_config() include ::Seofy::ActiveRecord::InstanceMethods before_create :seofy_before_create after_create :seofy_after_create end |
#seofy_adapter ⇒ Object
16 17 18 |
# File 'lib/seofy/active_record.rb', line 16 def seofy_adapter self.seofy_config.adapter end |