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.
5 6 7 8 9 |
# File 'lib/dynamic_scaffold/title.rb', line 5 def initialize(config) @config = config @titles_cache = {} @name = @config.model.model_name.human end |
Instance Attribute Details
#name(&block) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/dynamic_scaffold/title.rb', line 11 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
41 42 43 |
# File 'lib/dynamic_scaffold/title.rb', line 41 def create titles(:new) end |
#current ⇒ Object
21 22 23 |
# File 'lib/dynamic_scaffold/title.rb', line 21 def current public_send(@config.controller.params[:action]) end |
#edit ⇒ Object
29 30 31 |
# File 'lib/dynamic_scaffold/title.rb', line 29 def edit titles(:edit) end |
#index ⇒ Object
25 26 27 |
# File 'lib/dynamic_scaffold/title.rb', line 25 def index titles(:index) end |
#new ⇒ Object
33 34 35 |
# File 'lib/dynamic_scaffold/title.rb', line 33 def new titles(:new) end |
#update ⇒ Object
37 38 39 |
# File 'lib/dynamic_scaffold/title.rb', line 37 def update titles(:edit) end |