The Power of Rails 2.3 Engines & Templates

50 %
50 %
Information about The Power of Rails 2.3 Engines & Templates

Published on March 11, 2009

Author: tsechingho


The Power of Rails 2.3 Engines & Templates Tse-Ching Ho 2009/03/10

Rails app used to be rails engines_demo cd engines_demo script/generate scaffold product serial_number:string price:float discount:float quantity:integer name:string remark:string rake db:migrate sudo gem install png script/plugin install git:// script/server

Use Template rails <app> -m ~/template.rb rails <app> -m rake rails:template LOCATION=~/template.rb

Commands for Template plugin(name, options) capify! gem(name, options = {}) freeze! rake(command, options = {}) initializer(filename, data = nil, &block) generate(what, *args) lib(filename, data = nil, &block) route(routing_code) rakefile(filename, data = nil, &block) run(command, log_action = true) vendor(filename, data = nil, &block) git(command = {}) file(filename, data = nil, log_action = true, &block) inside(dir = '', &block) load_template(template) ask(question) environment(data = nil, &block) yes?(question) gsub_file(relative_destination, regexp, no?(question) *args, &block) rails-2.3.0/lib/rails_generator/generators/applications/app/ template_runner.rb

Lessons for Template hooks related commands of one gem or plugin groups hooked commands into functional sets files one set in one template writes scaffold generation template for project combines templates for each project

Start the Engine script/generate plugin <your-plugin> cd vendor/plugins/<your-plugin> mkdir app config db move codes to your plugin

Issues in Rails 2.3 Gem App routes.rb not loaded when both engine and inflections present Allow ActionMailer to use view_paths from plugins Improve view performance in development and reinstate template reloading in production rake rails:freeze:edge Rake tasks for run engine migrations


Authlogic_Bundle tsechingho/ authlogic_bundle Engines + template i18n + authlogic + open_id_authentication + declarative_authorization

barcode creator : barby created from template make into engines


References q=engines

Add a comment

Related presentations