Sha256: ff99a1022ae53ade2d536b74a668f496e33e154fa3feb632829b04e9f80d2ad8
Contents?: true
Size: 1.31 KB
Versions: 3
Compression:
Stored size: 1.31 KB
Contents
= MegaBar install the db tables: bundle exec rake railties:install:migrations FROM=mega_bar This project rocks and uses MIT-LICENSE. Override use of automatic templating: If none of the prebuilt 'record formats' suit your needs, but you'd still like to have access to the mega_bar things like the model and field information, you may want to write your own template. In your controller, add a method like this: def index_view_template @index_view_template ||= 'articles/my_index.html.erb' end Helper files: If you'd like to provide values for virtual attributes on edit screens, or do anything like setting variables needed by the view, that needs to be done after the controller runs and before the view runs, create a helper file like this one that is in app/helpers/mega_bar/models_helper.rb: module MegaBar module ModelsHelper def pre_render if params[:action] == 'edit' @index_model_display = ModelDisplay.by_model(@model.id).by_action('index').present? ? 'y':'' @show_model_display = ModelDisplay.by_model(@model.id).by_action('show').present? ? 'y':'' @new_model_display = ModelDisplay.by_model(@model.id).by_action('new').present? ? 'y':'' @edit_model_display = ModelDisplay.by_model(@model.id).by_action('edit').present? ? 'y':'' end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mega_bar-0.5.2 | README.rdoc |
mega_bar-0.5.1 | README.rdoc |
mega_bar-0.0.1 | README.rdoc |