Class: DynamicScaffold::Title
- Inherits:
-
Object
- Object
- DynamicScaffold::Title
- Defined in:
- lib/dynamic_scaffold/config.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #current ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
-
#initialize(config) ⇒ Title
constructor
A new instance of Title.
- #new ⇒ Object
Constructor Details
#initialize(config) ⇒ Title
Returns a new instance of Title.
51 52 53 54 55 |
# File 'lib/dynamic_scaffold/config.rb', line 51 def initialize(config) @config = config @titles_cache = {} @name = @config.model.model_name.human end |
Instance Attribute Details
#name(&block) ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/dynamic_scaffold/config.rb', line 57 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
#current ⇒ Object
67 68 69 |
# File 'lib/dynamic_scaffold/config.rb', line 67 def current public_send(@config.controller.params[:action]) end |
#edit ⇒ Object
75 76 77 |
# File 'lib/dynamic_scaffold/config.rb', line 75 def edit titles(:edit) end |
#index ⇒ Object
71 72 73 |
# File 'lib/dynamic_scaffold/config.rb', line 71 def index titles(:index) end |
#new ⇒ Object
79 80 81 |
# File 'lib/dynamic_scaffold/config.rb', line 79 def new titles(:new) end |