module FiSeo::ClassMethods
Public Instance Methods
acts_as_seoable(title, description, keywords, _options = {})
click to toggle source
# File lib/fi_seo.rb, line 72 def acts_as_seoable(title, description, keywords, _options = {}) extend ActsAsSeoableClassMethods include ActsAsSeoableInstanceMethods attr_names = [title, description, keywords] configuration = { check_for_changes: true, reverse: false, lowercase: false, index: false, noindex: false, nofollow: false, follow: false, noarchive: false, social: false, separator: '|', canonical: false } configuration.update(_options) if _options.present? configuration[:fields] = attr_names.flatten.uniq.compact class_attribute :seoable_options self.seoable_options = configuration self.send('after_create', :create_dynamic_seo_record) self.send('after_update', :update_dynamic_seo_record) self.send('has_one', :dynamic_seo, as: :seoable, dependent: :delete) self.send('accepts_nested_attributes_for', :dynamic_seo) end