Class: DynamicScaffold::Title
- Inherits:
-
Object
- Object
- DynamicScaffold::Title
- Defined in:
- lib/dynamic_scaffold/title.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
- #current ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
-
#initialize(config) ⇒ Title
constructor
A new instance of Title.
- #new ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(config) ⇒ Title
Returns a new instance of Title.
7 8 9 10 11 |
# File 'lib/dynamic_scaffold/title.rb', line 7 def initialize(config) @config = config @titles_cache = {} @name = @config.model.model_name.human end |
Instance Attribute Details
#name(&block) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/dynamic_scaffold/title.rb', line 13 def name(&block) if block_given? @block = block elsif !@block.nil? @config.controller.view_context.instance_exec(&@block) else @name end end |
Instance Method Details
#create ⇒ Object
43 44 45 |
# File 'lib/dynamic_scaffold/title.rb', line 43 def create titles(:new) end |
#current ⇒ Object
23 24 25 |
# File 'lib/dynamic_scaffold/title.rb', line 23 def current public_send(@config.controller.params[:action]) end |
#edit ⇒ Object
31 32 33 |
# File 'lib/dynamic_scaffold/title.rb', line 31 def edit titles(:edit) end |
#index ⇒ Object
27 28 29 |
# File 'lib/dynamic_scaffold/title.rb', line 27 def index titles(:index) end |
#new ⇒ Object
35 36 37 |
# File 'lib/dynamic_scaffold/title.rb', line 35 def new titles(:new) end |
#update ⇒ Object
39 40 41 |
# File 'lib/dynamic_scaffold/title.rb', line 39 def update titles(:edit) end |