Sha256: 55c4f23d737ce26e7f099d0ef1428e62b4f387249c3fdfa800ef44cfe0dbfad9
Contents?: true
Size: 1000 Bytes
Versions: 3
Compression:
Stored size: 1000 Bytes
Contents
# encoding: utf-8 module Tytus module ControllerExtensions def self.included(base) base.extend ClassMethods if base.respond_to? :class_inheritable_accessor base.class_inheritable_accessor :_page_title elsif base.respond_to? :class_attribute base.class_attribute :_page_title else base.superclass_delegating_accessor :_page_title end base.class_eval do include InstanceMethods end end module ClassMethods # Setup before filter which loads title for all actions. # def title(*args) options = args.extract_options! text = args before_filter(options) do |instance| instance.send(:title, text) end end end # ClassMethods module InstanceMethods # Setup title for the current resource # def title(text) self.class._page_title = text end end # InstanceMethods end # ControllerExtensions end # Tytus
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tytus-0.1.0 | lib/tytus/controller_extensions.rb |
tytus-0.0.2 | lib/tytus/controller_extensions.rb |
tytus-0.0.1 | lib/tytus/controller_extensions.rb |