Module: MetaManager::Taggable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/meta_manager/taggable.rb
Instance Method Summary collapse
-
#meta_tag(attr_name, options = {}) ⇒ Object
Save meta tags records into one hash.
- #respond_to?(method_sym, include_private = false) ⇒ Boolean
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (protected)
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/meta_manager/taggable.rb', line 32 def method_missing(method, *args, &block) key = method.to_s if key =~ attr_name = key.gsub(, '') if key =~ /=$/ && !args.first.blank? record = (attr_name.chop, :build => true) record.content = args.first else (attr_name).try(:content) end else super end end |
Instance Method Details
#meta_tag(attr_name, options = {}) ⇒ Object
Save meta tags records into one hash
12 13 14 15 16 |
# File 'lib/meta_manager/taggable.rb', line 12 def (attr_name, ={}) key = (attr_name) @meta_tag ||= {} @meta_tag[key] ||= self..where(:name => key).first || ([:build] ? self..build(:name => key) : nil) end |
#respond_to?(method_sym, include_private = false) ⇒ Boolean
18 19 20 21 22 23 24 |
# File 'lib/meta_manager/taggable.rb', line 18 def respond_to?(method_sym, include_private = false) if method_sym.to_s =~ true else super end end |