openskies 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +87 -0
- data/README.rdoc +35 -0
- data/bin/openskies +9 -0
- data/guides/assets/images/belongs_to.png +0 -0
- data/guides/assets/images/book_icon.gif +0 -0
- data/guides/assets/images/bullet.gif +0 -0
- data/guides/assets/images/challenge.png +0 -0
- data/guides/assets/images/chapters_icon.gif +0 -0
- data/guides/assets/images/check_bullet.gif +0 -0
- data/guides/assets/images/credits_pic_blank.gif +0 -0
- data/guides/assets/images/csrf.png +0 -0
- data/guides/assets/images/customized_error_messages.png +0 -0
- data/guides/assets/images/edge_badge.png +0 -0
- data/guides/assets/images/error_messages.png +0 -0
- data/guides/assets/images/feature_tile.gif +0 -0
- data/guides/assets/images/footer_tile.gif +0 -0
- data/guides/assets/images/fxn.png +0 -0
- data/guides/assets/images/grey_bullet.gif +0 -0
- data/guides/assets/images/habtm.png +0 -0
- data/guides/assets/images/has_many.png +0 -0
- data/guides/assets/images/has_many_through.png +0 -0
- data/guides/assets/images/has_one.png +0 -0
- data/guides/assets/images/has_one_through.png +0 -0
- data/guides/assets/images/header_backdrop.png +0 -0
- data/guides/assets/images/header_tile.gif +0 -0
- data/guides/assets/images/i18n/demo_html_safe.png +0 -0
- data/guides/assets/images/i18n/demo_localized_pirate.png +0 -0
- data/guides/assets/images/i18n/demo_translated_en.png +0 -0
- data/guides/assets/images/i18n/demo_translated_pirate.png +0 -0
- data/guides/assets/images/i18n/demo_translation_missing.png +0 -0
- data/guides/assets/images/i18n/demo_untranslated.png +0 -0
- data/guides/assets/images/icons/README +5 -0
- data/guides/assets/images/icons/callouts/1.png +0 -0
- data/guides/assets/images/icons/callouts/10.png +0 -0
- data/guides/assets/images/icons/callouts/11.png +0 -0
- data/guides/assets/images/icons/callouts/12.png +0 -0
- data/guides/assets/images/icons/callouts/13.png +0 -0
- data/guides/assets/images/icons/callouts/14.png +0 -0
- data/guides/assets/images/icons/callouts/15.png +0 -0
- data/guides/assets/images/icons/callouts/2.png +0 -0
- data/guides/assets/images/icons/callouts/3.png +0 -0
- data/guides/assets/images/icons/callouts/4.png +0 -0
- data/guides/assets/images/icons/callouts/5.png +0 -0
- data/guides/assets/images/icons/callouts/6.png +0 -0
- data/guides/assets/images/icons/callouts/7.png +0 -0
- data/guides/assets/images/icons/callouts/8.png +0 -0
- data/guides/assets/images/icons/callouts/9.png +0 -0
- data/guides/assets/images/icons/caution.png +0 -0
- data/guides/assets/images/icons/example.png +0 -0
- data/guides/assets/images/icons/home.png +0 -0
- data/guides/assets/images/icons/important.png +0 -0
- data/guides/assets/images/icons/next.png +0 -0
- data/guides/assets/images/icons/note.png +0 -0
- data/guides/assets/images/icons/prev.png +0 -0
- data/guides/assets/images/icons/tip.png +0 -0
- data/guides/assets/images/icons/up.png +0 -0
- data/guides/assets/images/icons/warning.png +0 -0
- data/guides/assets/images/jaimeiniesta.jpg +0 -0
- data/guides/assets/images/nav_arrow.gif +0 -0
- data/guides/assets/images/polymorphic.png +0 -0
- data/guides/assets/images/posts_index.png +0 -0
- data/guides/assets/images/radar.png +0 -0
- data/guides/assets/images/rails_guides_kindle_cover.jpg +0 -0
- data/guides/assets/images/rails_guides_logo.gif +0 -0
- data/guides/assets/images/rails_logo_remix.gif +0 -0
- data/guides/assets/images/rails_welcome.png +0 -0
- data/guides/assets/images/session_fixation.png +0 -0
- data/guides/assets/images/tab_grey.gif +0 -0
- data/guides/assets/images/tab_info.gif +0 -0
- data/guides/assets/images/tab_note.gif +0 -0
- data/guides/assets/images/tab_red.gif +0 -0
- data/guides/assets/images/tab_yellow.gif +0 -0
- data/guides/assets/images/tab_yellow.png +0 -0
- data/guides/assets/images/validation_error_messages.png +0 -0
- data/guides/assets/images/vijaydev.jpg +0 -0
- data/guides/assets/javascripts/guides.js +7 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +59 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +75 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +59 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +65 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +100 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +97 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +91 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +55 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +41 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +52 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +67 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +52 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +57 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +58 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +72 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +88 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +33 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +74 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +64 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +55 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +94 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +51 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +66 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +56 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +69 -0
- data/guides/assets/javascripts/syntaxhighlighter/shCore.js +17 -0
- data/guides/assets/stylesheets/fixes.css +16 -0
- data/guides/assets/stylesheets/kindle.css +11 -0
- data/guides/assets/stylesheets/main.css +453 -0
- data/guides/assets/stylesheets/print.css +52 -0
- data/guides/assets/stylesheets/reset.css +43 -0
- data/guides/assets/stylesheets/style.css +13 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCore.css +226 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +328 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +331 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +339 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +328 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +117 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +120 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +128 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +117 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +116 -0
- data/guides/code/getting_started/Gemfile +38 -0
- data/guides/code/getting_started/README.rdoc +261 -0
- data/guides/code/getting_started/Rakefile +7 -0
- data/guides/code/getting_started/app/assets/images/rails.png +0 -0
- data/guides/code/getting_started/app/assets/javascripts/application.js +15 -0
- data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/javascripts/home.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/application.css +13 -0
- data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/home.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss +56 -0
- data/guides/code/getting_started/app/controllers/application_controller.rb +3 -0
- data/guides/code/getting_started/app/controllers/comments_controller.rb +16 -0
- data/guides/code/getting_started/app/controllers/home_controller.rb +5 -0
- data/guides/code/getting_started/app/controllers/posts_controller.rb +84 -0
- data/guides/code/getting_started/app/helpers/application_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/comments_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/home_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/posts_helper.rb +5 -0
- data/guides/code/getting_started/app/models/comment.rb +3 -0
- data/guides/code/getting_started/app/models/post.rb +11 -0
- data/guides/code/getting_started/app/models/tag.rb +3 -0
- data/guides/code/getting_started/app/views/comments/_comment.html.erb +15 -0
- data/guides/code/getting_started/app/views/comments/_form.html.erb +13 -0
- data/guides/code/getting_started/app/views/home/index.html.erb +2 -0
- data/guides/code/getting_started/app/views/layouts/application.html.erb +14 -0
- data/guides/code/getting_started/app/views/posts/_form.html.erb +32 -0
- data/guides/code/getting_started/app/views/posts/edit.html.erb +6 -0
- data/guides/code/getting_started/app/views/posts/index.html.erb +27 -0
- data/guides/code/getting_started/app/views/posts/new.html.erb +5 -0
- data/guides/code/getting_started/app/views/posts/show.html.erb +31 -0
- data/guides/code/getting_started/app/views/tags/_form.html.erb +12 -0
- data/guides/code/getting_started/config/application.rb +59 -0
- data/guides/code/getting_started/config/boot.rb +6 -0
- data/guides/code/getting_started/config/database.yml +25 -0
- data/guides/code/getting_started/config/environment.rb +5 -0
- data/guides/code/getting_started/config/environments/development.rb +37 -0
- data/guides/code/getting_started/config/environments/production.rb +67 -0
- data/guides/code/getting_started/config/environments/test.rb +37 -0
- data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +7 -0
- data/guides/code/getting_started/config/initializers/inflections.rb +15 -0
- data/guides/code/getting_started/config/initializers/mime_types.rb +5 -0
- data/guides/code/getting_started/config/initializers/secret_token.rb +7 -0
- data/guides/code/getting_started/config/initializers/session_store.rb +8 -0
- data/guides/code/getting_started/config/initializers/wrap_parameters.rb +14 -0
- data/guides/code/getting_started/config/locales/en.yml +5 -0
- data/guides/code/getting_started/config/routes.rb +64 -0
- data/guides/code/getting_started/config.ru +4 -0
- data/guides/code/getting_started/db/migrate/20110901012504_create_posts.rb +11 -0
- data/guides/code/getting_started/db/migrate/20110901012815_create_comments.rb +12 -0
- data/guides/code/getting_started/db/migrate/20110901013701_create_tags.rb +11 -0
- data/guides/code/getting_started/db/schema.rb +43 -0
- data/guides/code/getting_started/db/seeds.rb +7 -0
- data/guides/code/getting_started/doc/README_FOR_APP +2 -0
- data/guides/code/getting_started/public/404.html +26 -0
- data/guides/code/getting_started/public/422.html +26 -0
- data/guides/code/getting_started/public/500.html +25 -0
- data/guides/code/getting_started/public/favicon.ico +0 -0
- data/guides/code/getting_started/public/robots.txt +5 -0
- data/guides/code/getting_started/script/rails +6 -0
- data/guides/code/getting_started/test/fixtures/comments.yml +11 -0
- data/guides/code/getting_started/test/fixtures/posts.yml +11 -0
- data/guides/code/getting_started/test/fixtures/tags.yml +9 -0
- data/guides/code/getting_started/test/functional/comments_controller_test.rb +7 -0
- data/guides/code/getting_started/test/functional/home_controller_test.rb +9 -0
- data/guides/code/getting_started/test/functional/posts_controller_test.rb +49 -0
- data/guides/code/getting_started/test/performance/browsing_test.rb +12 -0
- data/guides/code/getting_started/test/test_helper.rb +13 -0
- data/guides/code/getting_started/test/unit/comment_test.rb +7 -0
- data/guides/code/getting_started/test/unit/helpers/comments_helper_test.rb +4 -0
- data/guides/code/getting_started/test/unit/helpers/home_helper_test.rb +4 -0
- data/guides/code/getting_started/test/unit/helpers/posts_helper_test.rb +4 -0
- data/guides/code/getting_started/test/unit/post_test.rb +7 -0
- data/guides/code/getting_started/test/unit/tag_test.rb +7 -0
- data/guides/rails_guides/generator.rb +310 -0
- data/guides/rails_guides/helpers.rb +45 -0
- data/guides/rails_guides/indexer.rb +69 -0
- data/guides/rails_guides/levenshtein.rb +31 -0
- data/guides/rails_guides/textile_extensions.rb +63 -0
- data/guides/rails_guides.rb +50 -0
- data/guides/source/2_2_release_notes.textile +422 -0
- data/guides/source/2_3_release_notes.textile +610 -0
- data/guides/source/3_0_release_notes.textile +595 -0
- data/guides/source/3_1_release_notes.textile +553 -0
- data/guides/source/3_2_release_notes.textile +540 -0
- data/guides/source/_license.html.erb +2 -0
- data/guides/source/_welcome.html.erb +19 -0
- data/guides/source/action_controller_overview.textile +820 -0
- data/guides/source/action_mailer_basics.textile +516 -0
- data/guides/source/action_view_overview.textile +1497 -0
- data/guides/source/active_model_basics.textile +205 -0
- data/guides/source/active_record_basics.textile +218 -0
- data/guides/source/active_record_querying.textile +1433 -0
- data/guides/source/active_record_validations_callbacks.textile +1283 -0
- data/guides/source/active_resource_basics.textile +120 -0
- data/guides/source/active_support_core_extensions.textile +3713 -0
- data/guides/source/ajax_on_rails.textile +267 -0
- data/guides/source/api_documentation_guidelines.textile +185 -0
- data/guides/source/asset_pipeline.textile +707 -0
- data/guides/source/association_basics.textile +1959 -0
- data/guides/source/caching_with_rails.textile +437 -0
- data/guides/source/command_line.textile +574 -0
- data/guides/source/configuring.textile +641 -0
- data/guides/source/contributing_to_ruby_on_rails.textile +448 -0
- data/guides/source/credits.html.erb +72 -0
- data/guides/source/debugging_rails_applications.textile +714 -0
- data/guides/source/documents.yaml +157 -0
- data/guides/source/engines.textile +618 -0
- data/guides/source/form_helpers.textile +798 -0
- data/guides/source/generators.textile +621 -0
- data/guides/source/getting_started.textile +1929 -0
- data/guides/source/i18n.textile +931 -0
- data/guides/source/index.html.erb +30 -0
- data/guides/source/initialization.textile +1116 -0
- data/guides/source/kindle/KINDLE.md +26 -0
- data/guides/source/kindle/copyright.html.erb +1 -0
- data/guides/source/kindle/layout.html.erb +27 -0
- data/guides/source/kindle/rails_guides.opf.erb +52 -0
- data/guides/source/kindle/toc.html.erb +24 -0
- data/guides/source/kindle/toc.ncx.erb +64 -0
- data/guides/source/kindle/welcome.html.erb +5 -0
- data/guides/source/layout.html.erb +124 -0
- data/guides/source/layouts_and_rendering.textile +1237 -0
- data/guides/source/migrations.textile +900 -0
- data/guides/source/nested_model_forms.textile +222 -0
- data/guides/source/performance_testing.textile +597 -0
- data/guides/source/plugins.textile +464 -0
- data/guides/source/rails_application_templates.textile +240 -0
- data/guides/source/rails_on_rack.textile +236 -0
- data/guides/source/routing.textile +885 -0
- data/guides/source/ruby_on_rails_guides_guidelines.textile +79 -0
- data/guides/source/security.textile +1004 -0
- data/guides/source/testing.textile +947 -0
- data/guides/w3c_validator.rb +91 -0
- data/lib/rails/all.rb +15 -0
- data/lib/rails/application/bootstrap.rb +73 -0
- data/lib/rails/application/configuration.rb +151 -0
- data/lib/rails/application/finisher.rb +98 -0
- data/lib/rails/application/railties.rb +13 -0
- data/lib/rails/application/route_inspector.rb +84 -0
- data/lib/rails/application/routes_reloader.rb +56 -0
- data/lib/rails/application.rb +320 -0
- data/lib/rails/backtrace_cleaner.rb +42 -0
- data/lib/rails/cli.rb +16 -0
- data/lib/rails/code_statistics.rb +118 -0
- data/lib/rails/commands/application.rb +38 -0
- data/lib/rails/commands/benchmarker.rb +34 -0
- data/lib/rails/commands/console.rb +55 -0
- data/lib/rails/commands/dbconsole.rb +123 -0
- data/lib/rails/commands/destroy.rb +10 -0
- data/lib/rails/commands/generate.rb +12 -0
- data/lib/rails/commands/plugin.rb +544 -0
- data/lib/rails/commands/plugin_new.rb +11 -0
- data/lib/rails/commands/profiler.rb +32 -0
- data/lib/rails/commands/runner.rb +54 -0
- data/lib/rails/commands/server.rb +100 -0
- data/lib/rails/commands/update.rb +9 -0
- data/lib/rails/commands.rb +104 -0
- data/lib/rails/configuration.rb +89 -0
- data/lib/rails/console/app.rb +36 -0
- data/lib/rails/console/helpers.rb +11 -0
- data/lib/rails/engine/commands.rb +43 -0
- data/lib/rails/engine/configuration.rb +84 -0
- data/lib/rails/engine/railties.rb +33 -0
- data/lib/rails/engine.rb +657 -0
- data/lib/rails/generators/actions.rb +325 -0
- data/lib/rails/generators/active_model.rb +78 -0
- data/lib/rails/generators/app_base.rb +281 -0
- data/lib/rails/generators/base.rb +390 -0
- data/lib/rails/generators/css/assets/assets_generator.rb +13 -0
- data/lib/rails/generators/css/assets/templates/stylesheet.css +4 -0
- data/lib/rails/generators/css/scaffold/scaffold_generator.rb +16 -0
- data/lib/rails/generators/erb/controller/controller_generator.rb +20 -0
- data/lib/rails/generators/erb/controller/templates/view.html.erb +2 -0
- data/lib/rails/generators/erb/mailer/mailer_generator.rb +13 -0
- data/lib/rails/generators/erb/mailer/templates/view.text.erb +3 -0
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +29 -0
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +23 -0
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb +6 -0
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb +27 -0
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb +5 -0
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb +12 -0
- data/lib/rails/generators/erb.rb +21 -0
- data/lib/rails/generators/generated_attribute.rb +107 -0
- data/lib/rails/generators/js/assets/assets_generator.rb +13 -0
- data/lib/rails/generators/js/assets/templates/javascript.js +2 -0
- data/lib/rails/generators/migration.rb +68 -0
- data/lib/rails/generators/named_base.rb +202 -0
- data/lib/rails/generators/rails/app/USAGE +15 -0
- data/lib/rails/generators/rails/app/app_generator.rb +303 -0
- data/lib/rails/generators/rails/app/templates/Gemfile +26 -0
- data/lib/rails/generators/rails/app/templates/README +261 -0
- data/lib/rails/generators/rails/app/templates/Rakefile +7 -0
- data/lib/rails/generators/rails/app/templates/app/assets/images/rails.png +0 -0
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +17 -0
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +13 -0
- data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb +3 -0
- data/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb +2 -0
- data/lib/rails/generators/rails/app/templates/app/mailers/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/app/models/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +14 -0
- data/lib/rails/generators/rails/app/templates/config/application.rb +74 -0
- data/lib/rails/generators/rails/app/templates/config/boot.rb +6 -0
- data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml +31 -0
- data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +86 -0
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +62 -0
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +33 -0
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +43 -0
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +20 -0
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +54 -0
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +39 -0
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +55 -0
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +25 -0
- data/lib/rails/generators/rails/app/templates/config/environment.rb +5 -0
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +41 -0
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +73 -0
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +39 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb +7 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb +15 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb +5 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt +7 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +8 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +16 -0
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +5 -0
- data/lib/rails/generators/rails/app/templates/config/routes.rb +58 -0
- data/lib/rails/generators/rails/app/templates/config.ru +4 -0
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +7 -0
- data/lib/rails/generators/rails/app/templates/doc/README_FOR_APP +2 -0
- data/lib/rails/generators/rails/app/templates/gitignore +15 -0
- data/lib/rails/generators/rails/app/templates/public/404.html +26 -0
- data/lib/rails/generators/rails/app/templates/public/422.html +26 -0
- data/lib/rails/generators/rails/app/templates/public/500.html +25 -0
- data/lib/rails/generators/rails/app/templates/public/favicon.ico +0 -0
- data/lib/rails/generators/rails/app/templates/public/index.html +241 -0
- data/lib/rails/generators/rails/app/templates/public/robots.txt +5 -0
- data/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/script/rails +5 -0
- data/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/functional/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/integration/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb +12 -0
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb +15 -0
- data/lib/rails/generators/rails/app/templates/test/unit/.empty_directory +0 -0
- data/lib/rails/generators/rails/assets/USAGE +20 -0
- data/lib/rails/generators/rails/assets/assets_generator.rb +25 -0
- data/lib/rails/generators/rails/assets/templates/javascript.js +2 -0
- data/lib/rails/generators/rails/assets/templates/stylesheet.css +4 -0
- data/lib/rails/generators/rails/controller/USAGE +18 -0
- data/lib/rails/generators/rails/controller/controller_generator.rb +20 -0
- data/lib/rails/generators/rails/controller/templates/controller.rb +13 -0
- data/lib/rails/generators/rails/generator/USAGE +12 -0
- data/lib/rails/generators/rails/generator/generator_generator.rb +25 -0
- data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +3 -0
- data/lib/rails/generators/rails/generator/templates/USAGE.tt +8 -0
- data/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
- data/lib/rails/generators/rails/helper/USAGE +17 -0
- data/lib/rails/generators/rails/helper/helper_generator.rb +13 -0
- data/lib/rails/generators/rails/helper/templates/helper.rb +4 -0
- data/lib/rails/generators/rails/integration_test/USAGE +10 -0
- data/lib/rails/generators/rails/integration_test/integration_test_generator.rb +7 -0
- data/lib/rails/generators/rails/migration/USAGE +29 -0
- data/lib/rails/generators/rails/migration/migration_generator.rb +8 -0
- data/lib/rails/generators/rails/model/USAGE +45 -0
- data/lib/rails/generators/rails/model/model_generator.rb +8 -0
- data/lib/rails/generators/rails/observer/USAGE +12 -0
- data/lib/rails/generators/rails/observer/observer_generator.rb +7 -0
- data/lib/rails/generators/rails/performance_test/USAGE +10 -0
- data/lib/rails/generators/rails/performance_test/performance_test_generator.rb +7 -0
- data/lib/rails/generators/rails/plugin_new/USAGE +10 -0
- data/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +318 -0
- data/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec +29 -0
- data/lib/rails/generators/rails/plugin_new/templates/Gemfile +23 -0
- data/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE +20 -0
- data/lib/rails/generators/rails/plugin_new/templates/README.rdoc +3 -0
- data/lib/rails/generators/rails/plugin_new/templates/Rakefile +31 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/controllers/%name%/application_controller.rb.tt +4 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/helpers/%name%/application_helper.rb.tt +4 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/mailers/.empty_directory +0 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/models/.empty_directory +0 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/views/layouts/%name%/application.html.erb.tt +14 -0
- data/lib/rails/generators/rails/plugin_new/templates/config/routes.rb +6 -0
- data/lib/rails/generators/rails/plugin_new/templates/gitignore +7 -0
- data/lib/rails/generators/rails/plugin_new/templates/lib/%name%/engine.rb +7 -0
- data/lib/rails/generators/rails/plugin_new/templates/lib/%name%/version.rb +3 -0
- data/lib/rails/generators/rails/plugin_new/templates/lib/%name%.rb +6 -0
- data/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%name%_tasks.rake +4 -0
- data/lib/rails/generators/rails/plugin_new/templates/rails/application.rb +18 -0
- data/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb +10 -0
- data/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb +4 -0
- data/lib/rails/generators/rails/plugin_new/templates/script/rails.tt +7 -0
- data/lib/rails/generators/rails/plugin_new/templates/test/%name%_test.rb +7 -0
- data/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb +12 -0
- data/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb +15 -0
- data/lib/rails/generators/rails/resource/USAGE +23 -0
- data/lib/rails/generators/rails/resource/resource_generator.rb +20 -0
- data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +50 -0
- data/lib/rails/generators/rails/scaffold/USAGE +35 -0
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +23 -0
- data/lib/rails/generators/rails/scaffold/templates/scaffold.css +56 -0
- data/lib/rails/generators/rails/scaffold_controller/USAGE +19 -0
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +25 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +89 -0
- data/lib/rails/generators/rails/session_migration/USAGE +8 -0
- data/lib/rails/generators/rails/session_migration/session_migration_generator.rb +8 -0
- data/lib/rails/generators/rails/task/USAGE +9 -0
- data/lib/rails/generators/rails/task/task_generator.rb +12 -0
- data/lib/rails/generators/rails/task/templates/task.rb +8 -0
- data/lib/rails/generators/resource_helpers.rb +80 -0
- data/lib/rails/generators/test_case.rb +247 -0
- data/lib/rails/generators/test_unit/controller/controller_generator.rb +15 -0
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb +19 -0
- data/lib/rails/generators/test_unit/helper/helper_generator.rb +13 -0
- data/lib/rails/generators/test_unit/helper/templates/helper_test.rb +6 -0
- data/lib/rails/generators/test_unit/integration/integration_generator.rb +13 -0
- data/lib/rails/generators/test_unit/integration/templates/integration_test.rb +7 -0
- data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +14 -0
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +21 -0
- data/lib/rails/generators/test_unit/model/model_generator.rb +24 -0
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml +23 -0
- data/lib/rails/generators/test_unit/model/templates/unit_test.rb +9 -0
- data/lib/rails/generators/test_unit/observer/observer_generator.rb +13 -0
- data/lib/rails/generators/test_unit/observer/templates/unit_test.rb +9 -0
- data/lib/rails/generators/test_unit/performance/performance_generator.rb +13 -0
- data/lib/rails/generators/test_unit/performance/templates/performance_test.rb +12 -0
- data/lib/rails/generators/test_unit/plugin/plugin_generator.rb +13 -0
- data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +7 -0
- data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +3 -0
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +38 -0
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +51 -0
- data/lib/rails/generators/test_unit.rb +8 -0
- data/lib/rails/generators.rb +339 -0
- data/lib/rails/info.rb +116 -0
- data/lib/rails/info_controller.rb +15 -0
- data/lib/rails/initializable.rb +89 -0
- data/lib/rails/paths.rb +211 -0
- data/lib/rails/performance_test_help.rb +3 -0
- data/lib/rails/plugin.rb +92 -0
- data/lib/rails/rack/debugger.rb +24 -0
- data/lib/rails/rack/log_tailer.rb +34 -0
- data/lib/rails/rack/logger.rb +60 -0
- data/lib/rails/rack.rb +7 -0
- data/lib/rails/railtie/configurable.rb +35 -0
- data/lib/rails/railtie/configuration.rb +90 -0
- data/lib/rails/railtie.rb +202 -0
- data/lib/rails/ruby_version_check.rb +23 -0
- data/lib/rails/rubyprof_ext.rb +35 -0
- data/lib/rails/script_rails_loader.rb +29 -0
- data/lib/rails/source_annotation_extractor.rb +104 -0
- data/lib/rails/tasks/annotations.rake +20 -0
- data/lib/rails/tasks/documentation.rake +155 -0
- data/lib/rails/tasks/engine.rake +72 -0
- data/lib/rails/tasks/framework.rake +76 -0
- data/lib/rails/tasks/log.rake +9 -0
- data/lib/rails/tasks/middleware.rake +7 -0
- data/lib/rails/tasks/misc.rake +67 -0
- data/lib/rails/tasks/routes.rake +9 -0
- data/lib/rails/tasks/statistics.rake +16 -0
- data/lib/rails/tasks/tmp.rake +37 -0
- data/lib/rails/tasks.rb +16 -0
- data/lib/rails/test_help.rb +56 -0
- data/lib/rails/test_unit/railtie.rb +15 -0
- data/lib/rails/test_unit/sub_test_task.rb +8 -0
- data/lib/rails/test_unit/testing.rake +146 -0
- data/lib/rails/version.rb +10 -0
- data/lib/rails.rb +126 -0
- metadata +609 -0
@@ -0,0 +1,618 @@
|
|
1
|
+
h2. Getting Started with Engines
|
2
|
+
|
3
|
+
In this guide you will learn about engines and how they can be used to provide additional functionality to their host applications through a clean and very easy-to-use interface. You will learn the following things in this guide:
|
4
|
+
|
5
|
+
* What makes an engine
|
6
|
+
* How to generate an engine
|
7
|
+
* Building features for the engine
|
8
|
+
* Hooking the engine into an application
|
9
|
+
* Overriding engine functionality in the application
|
10
|
+
|
11
|
+
endprologue.
|
12
|
+
|
13
|
+
h3. What are engines?
|
14
|
+
|
15
|
+
Engines can be considered miniature applications that provide functionality to their host applications. A Rails application is actually just a "supercharged" engine, with the +Rails::Application+ class inheriting from +Rails::Engine+. Therefore, engines and applications share common functionality but are at the same time two separate beasts. Engines and applications also share a common structure, as you'll see throughout this guide.
|
16
|
+
|
17
|
+
Engines are also closely related to plugins where the two share a common +lib+ directory structure and are both generated using the +rails plugin new+ generator.
|
18
|
+
|
19
|
+
The engine that will be generated for this guide will be called "blorgh". The engine will provide blogging functionality to its host applications, allowing for new posts and comments to be created. For now, you will be working solely within the engine itself and in later sections you'll see how to hook it into an application.
|
20
|
+
|
21
|
+
Engines can also be isolated from their host applications. This means that an application is able to have a path provided by a routing helper such as +posts_path+ and use an engine also that provides a path also called +posts_path+, and the two would not clash. Along with this, controllers, models and table names are also namespaced. You'll see how to do this later in this guide.
|
22
|
+
|
23
|
+
To see demonstrations of other engines, check out "Devise":https://github.com/plataformatec/devise, an engine that provides authentication for its parent applications, or "Forem":https://github.com/radar/forem, an engine that provides forum functionality.
|
24
|
+
|
25
|
+
Finally, engines would not have be possible without the work of James Adam, Piotr Sarnacki, the Rails Core Team, and a number of other people. If you ever meet them, don't forget to say thanks!
|
26
|
+
|
27
|
+
h3. Generating an engine
|
28
|
+
|
29
|
+
To generate an engine with Rails 3.1, you will need to run the plugin generator and pass it the +--mountable+ option. To generate the beginnings of the "blorgh" engine you will need to run this command in a terminal:
|
30
|
+
|
31
|
+
<shell>
|
32
|
+
$ rails plugin new blorgh --mountable
|
33
|
+
</shell>
|
34
|
+
|
35
|
+
The +--mountable+ option tells the plugin generator that you want to create an engine (which is a mountable plugin, hence the option name), creating the basic directory structure of an engine by providing things such as the foundations of an +app+ folder, as well a +config/routes.rb+ file. This generator also provides a file at +lib/blorgh/engine.rb+ which is identical in function to an application's +config/application.rb+ file.
|
36
|
+
|
37
|
+
h4. Inside an engine
|
38
|
+
|
39
|
+
h5. Critical files
|
40
|
+
|
41
|
+
At the root of the engine's directory, lives a +blorgh.gemspec+ file. When you include the engine into the application later on, you will do so with this line in a Rails application's +Gemfile+:
|
42
|
+
|
43
|
+
<ruby>
|
44
|
+
gem 'blorgh', :path => "vendor/engines/blorgh"
|
45
|
+
</ruby>
|
46
|
+
|
47
|
+
By specifying it as a gem within the +Gemfile+, Bundler will load it as such, parsing this +blorgh.gemspec+ file and requiring a file within the +lib+ directory called +lib/blorgh.rb+. This file requires the +blorgh/engine.rb+ file (located at +lib/blorgh/engine.rb+) and defines a base module called +Blorgh+.
|
48
|
+
|
49
|
+
<ruby>
|
50
|
+
require "blorgh/engine"
|
51
|
+
|
52
|
+
module Blorgh
|
53
|
+
end
|
54
|
+
</ruby>
|
55
|
+
|
56
|
+
Within +lib/blorgh/engine.rb+ is the base class for the engine:
|
57
|
+
|
58
|
+
<ruby>
|
59
|
+
module Blorgh
|
60
|
+
class Engine < Rails::Engine
|
61
|
+
isolate_namespace Blorgh
|
62
|
+
end
|
63
|
+
end
|
64
|
+
</ruby>
|
65
|
+
|
66
|
+
By inheriting from the +Rails::Engine+ class, this engine gains all the functionality it needs, such as being able to serve requests to its controllers.
|
67
|
+
|
68
|
+
The +isolate_namespace+ method here deserves special notice. This call is responsible for isolating the controllers, models, routes and other things into their own namespace. Without this, there is a possibility that the engine's components could "leak" into the application, causing unwanted disruption. It is recommended that this line be left within this file.
|
69
|
+
|
70
|
+
h5. +app+ directory
|
71
|
+
|
72
|
+
Inside the +app+ directory there lives the standard +assets+, +controllers+, +helpers+, +mailers+, +models+ and +views+ directories that you should be familiar with from an application. The +helpers+, +mailers+ and +models+ directories are empty and so aren't described in this section. We'll look more into models in a future section.
|
73
|
+
|
74
|
+
Within the +app/assets+ directory, there is the +images+, +javascripts+ and +stylesheets+ directories which, again, you should be familiar with due to their similarities of an application. One difference here however is that each directory contains a sub-directory with the engine name. Because this engine is going to be namespaced, its assets should be too.
|
75
|
+
|
76
|
+
Within the +app/controllers+ directory there is a +blorgh+ directory and inside that a file called +application_controller.rb+. This file will provide any common functionality for the controllers of the engine. The +blorgh+ directory is where the other controllers for the engine will go. By placing them within this namespaced directory, you prevent them from possibly clashing with identically-named controllers within other engines or even within the application.
|
77
|
+
|
78
|
+
Lastly, the +app/views+ directory contains a +layouts+ folder which contains file at +blorgh/application.html.erb+ which allows you to specify a layout for the engine. If this engine is to be used as a stand-alone engine, then you would add any customization to its layout in this file, rather than the applications +app/views/layouts/application.html.erb+ file.
|
79
|
+
|
80
|
+
h5. +script+ directory
|
81
|
+
|
82
|
+
This directory contains one file, +script/rails+, which allows you to use the +rails+ sub-commands and generators just like you would within an application. This means that you will very easily be able to generate new controllers and models for this engine.
|
83
|
+
|
84
|
+
h5. +test+ directory
|
85
|
+
|
86
|
+
The +test+ directory is where tests for the engine will go. To test the engine, there is a cut-down version of a Rails application embedded within it at +test/dummy+. This application will mount the engine in the +test/dummy/config/routes.rb+ file:
|
87
|
+
|
88
|
+
<ruby>
|
89
|
+
Rails.application.routes.draw do
|
90
|
+
|
91
|
+
mount Blorgh::Engine => "/blorgh"
|
92
|
+
end
|
93
|
+
</ruby>
|
94
|
+
|
95
|
+
This line mounts the engine at the path of +/blorgh+, which will make it accessible through the application only at that path. We will look more into mounting an engine after some features have been developed.
|
96
|
+
|
97
|
+
Also in the test directory is the +test/integration+ directory, where integration tests for the engine should be placed.
|
98
|
+
|
99
|
+
h3. Providing engine functionality
|
100
|
+
|
101
|
+
The engine that this guide covers will provide posting and commenting functionality and follows a similar thread to the "Getting Started Guide":getting-started.html, with some new twists.
|
102
|
+
|
103
|
+
h4. Generating a post resource
|
104
|
+
|
105
|
+
The first thing to generate for a blog engine is the +Post+ model and related controller. To quickly generate this, you can use the Rails scaffold generator.
|
106
|
+
|
107
|
+
<shell>
|
108
|
+
$ rails generate scaffold post title:string text:text
|
109
|
+
</shell>
|
110
|
+
|
111
|
+
This command will output this information:
|
112
|
+
|
113
|
+
<shell>
|
114
|
+
invoke active_record
|
115
|
+
create db/migrate/[timestamp]_create_blorgh_posts.rb
|
116
|
+
create app/models/blorgh/post.rb
|
117
|
+
invoke test_unit
|
118
|
+
create test/unit/blorgh/post_test.rb
|
119
|
+
create test/fixtures/blorgh/posts.yml
|
120
|
+
route resources :posts
|
121
|
+
invoke scaffold_controller
|
122
|
+
create app/controllers/blorgh/posts_controller.rb
|
123
|
+
invoke erb
|
124
|
+
create app/views/blorgh/posts
|
125
|
+
create app/views/blorgh/posts/index.html.erb
|
126
|
+
create app/views/blorgh/posts/edit.html.erb
|
127
|
+
create app/views/blorgh/posts/show.html.erb
|
128
|
+
create app/views/blorgh/posts/new.html.erb
|
129
|
+
create app/views/blorgh/posts/_form.html.erb
|
130
|
+
invoke test_unit
|
131
|
+
create test/functional/blorgh/posts_controller_test.rb
|
132
|
+
invoke helper
|
133
|
+
create app/helpers/blorgh/posts_helper.rb
|
134
|
+
invoke test_unit
|
135
|
+
create test/unit/helpers/blorgh/posts_helper_test.rb
|
136
|
+
invoke assets
|
137
|
+
invoke js
|
138
|
+
create app/assets/javascripts/blorgh/posts.js
|
139
|
+
invoke css
|
140
|
+
create app/assets/stylesheets/blorgh/posts.css
|
141
|
+
invoke css
|
142
|
+
create app/assets/stylesheets/scaffold.css
|
143
|
+
</shell>
|
144
|
+
|
145
|
+
The first thing that the scaffold generator does is invoke the +active_record+ generator, which generates a migration and a model for the resource. Note here, however, that the migration is called +create_blorgh_posts+ rather than the usual +create_posts+. This is due to the +isolate_namespace+ method called in the +Blorgh::Engine+ class's definition. The model here is also namespaced, being placed at +app/models/blorgh/post.rb+ rather than +app/models/post.rb+.
|
146
|
+
|
147
|
+
Next, the +test_unit+ generator is invoked for this model, generating a unit test at +test/unit/blorgh/post_test.rb+ (rather than +test/unit/post_test.rb+) and a fixture at +test/fixtures/blorgh/posts.yml+ (rather than +test/fixtures/posts.yml+).
|
148
|
+
|
149
|
+
After that, a line for the resource is inserted into the +config/routes.rb+ file for the engine. This line is simply +resources :posts+, turning the +config/routes.rb+ file into this:
|
150
|
+
|
151
|
+
<ruby>
|
152
|
+
Blorgh::Engine.routes.draw do
|
153
|
+
resources :posts
|
154
|
+
|
155
|
+
end
|
156
|
+
</ruby>
|
157
|
+
|
158
|
+
Note here that the routes are drawn upon the +Blorgh::Engine+ object rather than the +YourApp::Application+ class. This is so that the engine routes are confined to the engine itself and can be mounted at a specific point as shown in the "test directory":#test-directory section.
|
159
|
+
|
160
|
+
Next, the +scaffold_controller+ generator is invoked, generating a controlled called +Blorgh::PostsController+ (at +app/controllers/blorgh/posts_controller.rb+) and its related views at +app/views/blorgh/posts+. This generator also generates a functional test for the controller (+test/functional/blorgh/posts_controller_test.rb+) and a helper (+app/helpers/blorgh/posts_controller.rb+).
|
161
|
+
|
162
|
+
Everything this generator has generated is neatly namespaced. The controller's class is defined within the +Blorgh+ module:
|
163
|
+
|
164
|
+
<ruby>
|
165
|
+
module Blorgh
|
166
|
+
class PostsController < ApplicationController
|
167
|
+
...
|
168
|
+
end
|
169
|
+
end
|
170
|
+
</ruby>
|
171
|
+
|
172
|
+
NOTE: The +ApplicationController+ class being inherited from here is the +Blorgh::ApplicationController+, not an application's +ApplicationController+.
|
173
|
+
|
174
|
+
The helper is also namespaced:
|
175
|
+
|
176
|
+
<ruby>
|
177
|
+
module Blorgh
|
178
|
+
class PostsHelper
|
179
|
+
...
|
180
|
+
end
|
181
|
+
end
|
182
|
+
</ruby>
|
183
|
+
|
184
|
+
This helps prevent conflicts with any other engine or application that may have a post resource also.
|
185
|
+
|
186
|
+
Finally, two files that are the assets for this resource are generated, +app/assets/javascripts/blorgh/posts.js+ and +app/assets/javascripts/blorgh/posts.css+. You'll see how to use these a little later.
|
187
|
+
|
188
|
+
By default, the scaffold styling is not applied to the engine as the engine's layout file, +app/views/blorgh/application.html.erb+ doesn't load it. To make this apply, insert this line into the +<head>+ tag of this layout:
|
189
|
+
|
190
|
+
<erb>
|
191
|
+
<%= stylesheet_link_tag "scaffold" %>
|
192
|
+
</erb>
|
193
|
+
|
194
|
+
You can see what the engine has so far by running +rake db:migrate+ at the root of our engine to run the migration generated by the scaffold generator, and then running +rails server+. When you open +http://localhost:3000/blorgh/posts+ you will see the default scaffold that has been generated.
|
195
|
+
|
196
|
+
!images/engines_scaffold.png(Blank engine scaffold)!
|
197
|
+
|
198
|
+
Click around! You've just generated your first engine's first functions.
|
199
|
+
|
200
|
+
If you'd rather play around in the console, +rails console+ will also work just like a Rails application. Remember: the +Post+ model is namespaced, so to reference it you must call it as +Blorgh::Post+.
|
201
|
+
|
202
|
+
<ruby>
|
203
|
+
>> Blorgh::Post.find(1)
|
204
|
+
=> #<Blorgh::Post id: 1 ...>
|
205
|
+
</ruby>
|
206
|
+
|
207
|
+
One final thing is that the +posts+ resource for this engine should be the root of the engine. Whenever someone goes to the root path where the engine is mounted, they should be shown a list of posts. This can be made to happen if this line is inserted into the +config/routes.rb+ file inside the engine:
|
208
|
+
|
209
|
+
<ruby>
|
210
|
+
root :to => "posts#index"
|
211
|
+
</ruby>
|
212
|
+
|
213
|
+
Now people will only need to go to the root of the engine to see all the posts, rather than visiting +/posts+.
|
214
|
+
|
215
|
+
h4. Generating a comments resource
|
216
|
+
|
217
|
+
Now that the engine has the ability to create new blog posts, it only makes sense to add commenting functionality as well. To do get this, you'll need to generate a comment model, a comment controller and then modify the posts scaffold to display comments and allow people to create new ones.
|
218
|
+
|
219
|
+
Run the model generator and tell it to generate a +Comment+ model, with the related table having two columns: a +post_id+ integer and +text+ text column.
|
220
|
+
|
221
|
+
<shell>
|
222
|
+
$ rails generate model Comment post_id:integer text:text
|
223
|
+
</shell>
|
224
|
+
|
225
|
+
This will output the following:
|
226
|
+
|
227
|
+
<shell>
|
228
|
+
invoke active_record
|
229
|
+
create db/migrate/[timestamp]_create_blorgh_comments.rb
|
230
|
+
create app/models/blorgh/comment.rb
|
231
|
+
invoke test_unit
|
232
|
+
create test/unit/blorgh/comment_test.rb
|
233
|
+
create test/fixtures/blorgh/comments.yml
|
234
|
+
</shell>
|
235
|
+
|
236
|
+
This generator call will generate just the necessary model files it needs, namespacing the files under a +blorgh+ directory and creating a model class called +Blorgh::Comment+.
|
237
|
+
|
238
|
+
To show the comments on a post, edit +app/views/posts/show.html.erb+ and add this line before the "Edit" link:
|
239
|
+
|
240
|
+
<erb>
|
241
|
+
<h3>Comments</h3>
|
242
|
+
<%= render @post.comments %>
|
243
|
+
</erb>
|
244
|
+
|
245
|
+
This line will require there to be a +has_many+ association for comments defined on the +Blorgh::Post+ model, which there isn't right now. To define one, open +app/models/blorgh/post.rb+ and add this line into the model:
|
246
|
+
|
247
|
+
<ruby>
|
248
|
+
has_many :comments
|
249
|
+
</ruby>
|
250
|
+
|
251
|
+
Turning the model into this:
|
252
|
+
|
253
|
+
<ruby>
|
254
|
+
module Blorgh
|
255
|
+
class Post < ActiveRecord::Base
|
256
|
+
has_many :comments
|
257
|
+
end
|
258
|
+
end
|
259
|
+
</ruby>
|
260
|
+
|
261
|
+
Because the +has_many+ is defined inside a class that is inside the +Blorgh+ module, Rails will know that you want to use the +Blorgh::Comment+ model for these objects.
|
262
|
+
|
263
|
+
Next, there needs to be a form so that comments can be created on a post. To add this, put this line underneath the call to +render @post.comments+ in +app/views/blorgh/posts/show.html.erb+:
|
264
|
+
|
265
|
+
<erb>
|
266
|
+
<%= render "blorgh/comments/form" %>
|
267
|
+
</erb>
|
268
|
+
|
269
|
+
Next, the partial that this line will render needs to exist. Create a new directory at +app/views/blorgh/comments+ and in it a new file called +_form.html.erb+ which has this content to create the required partial:
|
270
|
+
|
271
|
+
<erb>
|
272
|
+
<h3>New comment</h3>
|
273
|
+
<%= form_for [@post, @post.comments.build] do |f| %>
|
274
|
+
<p>
|
275
|
+
<%= f.label :text %><br />
|
276
|
+
<%= f.text_area :text %>
|
277
|
+
</p>
|
278
|
+
<%= f.submit %>
|
279
|
+
<% end %>
|
280
|
+
</erb>
|
281
|
+
|
282
|
+
This form, when submitted, is going to attempt to post to a route of +posts/:post_id/comments+ within the engine. This route doesn't exist at the moment, but can be created by changing the +resources :posts+ line inside +config/routes.rb+ into these lines:
|
283
|
+
|
284
|
+
<ruby>
|
285
|
+
resources :posts do
|
286
|
+
resources :comments
|
287
|
+
end
|
288
|
+
</ruby>
|
289
|
+
|
290
|
+
The route now will exist, but the controller that this route goes to does not. To create it, run this command:
|
291
|
+
|
292
|
+
<shell>
|
293
|
+
$ rails g controller comments
|
294
|
+
</shell>
|
295
|
+
|
296
|
+
This will generate the following things:
|
297
|
+
|
298
|
+
<shell>
|
299
|
+
create app/controllers/blorgh/comments_controller.rb
|
300
|
+
invoke erb
|
301
|
+
exist app/views/blorgh/comments
|
302
|
+
invoke test_unit
|
303
|
+
create test/functional/blorgh/comments_controller_test.rb
|
304
|
+
invoke helper
|
305
|
+
create app/helpers/blorgh/comments_helper.rb
|
306
|
+
invoke test_unit
|
307
|
+
create test/unit/helpers/blorgh/comments_helper_test.rb
|
308
|
+
invoke assets
|
309
|
+
invoke js
|
310
|
+
create app/assets/javascripts/blorgh/comments.js
|
311
|
+
invoke css
|
312
|
+
create app/assets/stylesheets/blorgh/comments.css
|
313
|
+
</shell>
|
314
|
+
|
315
|
+
The form will be making a +POST+ request to +/posts/:post_id/comments+, which will correspond with the +create+ action in +Blorgh::CommentsController+. This action needs to be created and can be done by putting the following lines inside the class definition in +app/controllers/blorgh/comments_controller.rb+:
|
316
|
+
|
317
|
+
<ruby>
|
318
|
+
def create
|
319
|
+
@post = Post.find(params[:post_id])
|
320
|
+
@comment = @post.comments.build(params[:comment])
|
321
|
+
flash[:notice] = "Comment has been created!"
|
322
|
+
redirect_to post_path
|
323
|
+
end
|
324
|
+
</ruby>
|
325
|
+
|
326
|
+
This is the final part required to get the new comment form working. Displaying the comments however, is not quite right yet. If you were to create a comment right now you would see this error:
|
327
|
+
|
328
|
+
<text>
|
329
|
+
Missing partial blorgh/comments/comment with {:handlers=>[:erb, :builder], :formats=>[:html], :locale=>[:en, :en]}. Searched in:
|
330
|
+
* "/Users/ryan/Sites/side_projects/blorgh/test/dummy/app/views"
|
331
|
+
* "/Users/ryan/Sites/side_projects/blorgh/app/views"
|
332
|
+
</text>
|
333
|
+
|
334
|
+
The engine is unable to find the partial required for rendering the comments. Rails has looked firstly in the application's (+test/dummy+) +app/views+ directory and then in the engine's +app/views+ directory. When it can't find it, it will throw this error. The engine knows to look for +blorgh/comments/comment+ because the model object it is receiving is from the +Blorgh::Comment+ class.
|
335
|
+
|
336
|
+
This partial will be responsible for rendering just the comment text, for now. Create a new file at +app/views/blorgh/comments/_comment.html.erb+ and put this line inside it:
|
337
|
+
|
338
|
+
<erb>
|
339
|
+
<%= comment_counter + 1 %>. <%= comment.text %>
|
340
|
+
</erb>
|
341
|
+
|
342
|
+
The +comment_counter+ local variable is given to us by the +<%= render @post.comments %>+ call, as it will define this automatically and increment the counter as it iterates through each comment. It's used in this example to display a small number next to each comment when it's created.
|
343
|
+
|
344
|
+
That completes the comment function of the blogging engine. Now it's time to use it within an application.
|
345
|
+
|
346
|
+
h3. Hooking into an application
|
347
|
+
|
348
|
+
Using an engine within an application is very easy. This section covers how to mount the engine into an application and the initial setup required for it, as well as linking the engine to a +User+ class provided by the application to provide ownership for posts and comments within the engine.
|
349
|
+
|
350
|
+
h4. Mounting the engine
|
351
|
+
|
352
|
+
First, the engine needs to be specified inside the application's +Gemfile+. If there isn't an application handy to test this out in, generate one using the +rails new+ command outside of the engine directory like this:
|
353
|
+
|
354
|
+
<shell>
|
355
|
+
$ rails new unicorn
|
356
|
+
</shell>
|
357
|
+
|
358
|
+
Usually, specifying the engine inside the Gemfile would be done by specifying it as a normal, everyday gem.
|
359
|
+
|
360
|
+
<ruby>
|
361
|
+
gem 'devise'
|
362
|
+
</ruby>
|
363
|
+
|
364
|
+
Because the +blorgh+ engine is still under development, it will need to have a +:path+ option for its +Gemfile+ specification:
|
365
|
+
|
366
|
+
<ruby>
|
367
|
+
gem 'blorgh', :path => "/path/to/blorgh"
|
368
|
+
</ruby>
|
369
|
+
|
370
|
+
If the whole +blorgh+ engine directory is copied to +vendor/engines/blorgh+ then it could be specified in the +Gemfile+ like this:
|
371
|
+
|
372
|
+
<ruby>
|
373
|
+
gem 'blorgh', :path => "vendor/engines/blorgh"
|
374
|
+
</ruby>
|
375
|
+
|
376
|
+
As described earlier, by placing the gem in the +Gemfile+ it will be loaded when Rails is loaded, as it will first require +lib/blorgh.rb+ in the engine and then +lib/blorgh/engine.rb+, which is the file that defines the major pieces of functionality for the engine.
|
377
|
+
|
378
|
+
To make the engine's functionality accessible from within an application, it needs to be mounted in that application's +config/routes.rb+ file:
|
379
|
+
|
380
|
+
<ruby>
|
381
|
+
mount Blorgh::Engine, :at => "blog"
|
382
|
+
</ruby>
|
383
|
+
|
384
|
+
This line will mount the engine at +blog+ in the application. Making it accessible at +http://localhost:3000/blog+ when the application runs with +rails s+.
|
385
|
+
|
386
|
+
NOTE: Other engines, such as Devise, handle this a little differently by making you specify custom helpers such as +devise_for+ in the routes. These helpers do exactly the same thing, mounting pieces of the engines's functionality at a pre-defined path which may be customizable.
|
387
|
+
|
388
|
+
h4. Engine setup
|
389
|
+
|
390
|
+
The engine contains migrations for the +blorgh_posts+ and +blorgh_comments+ table which need to be created in the application's database so that the engine's models can query them correctly. To copy these migrations into the application use this command:
|
391
|
+
|
392
|
+
<shell>
|
393
|
+
$ rake blorgh:install:migrations
|
394
|
+
</shell>
|
395
|
+
|
396
|
+
This command, when run for the first time will copy over all the migrations from the engine. When run the next time, it will only copy over migrations that haven't been copied over already. The first run for this command will output something such as this:
|
397
|
+
|
398
|
+
<shell>
|
399
|
+
Copied migration [timestamp_1]_create_blorgh_posts.rb from blorgh
|
400
|
+
Copied migration [timestamp_2]_create_blorgh_comments.rb from blorgh
|
401
|
+
</shell>
|
402
|
+
|
403
|
+
The first timestamp (+\[timestamp_1\]+) will be the current time and the second timestamp (+\[timestamp_2\]+) will be the current time plus a second. The reason for this is so that the migrations for the engine are run after any existing migrations in the application.
|
404
|
+
|
405
|
+
To run these migrations within the context of the application, simply run +rake db:migrate+. When accessing the engine through +http://localhost:3000/blog+, the posts will be empty. This is because the table created inside the application is different from the one created within the engine. Go ahead, play around with the newly mounted engine. You'll find that it's the same as when it was only an engine.
|
406
|
+
|
407
|
+
h4. Using a class provided by the application
|
408
|
+
|
409
|
+
When an engine is created, it may want to use specific classes from an application to provide links between the pieces of the engine and the pieces of the application. In the case of the +blorgh+ engine, making posts and comments have authors would make a lot of sense.
|
410
|
+
|
411
|
+
Usually, an application would have a +User+ class that would provide the objects that would represent the posts' and comments' authors, but there could be a case where the application calls this class something different, such as +Person+. It's because of this reason that the engine should not hardcode the associations to be exactly for a +User+ class, but should allow for some flexibility around what the class is called.
|
412
|
+
|
413
|
+
To keep it simple in this case, the application will have a class called +User+ which will represent the users of the application. It can be generated using this command:
|
414
|
+
|
415
|
+
<shell>
|
416
|
+
rails g model user name:string
|
417
|
+
</shell>
|
418
|
+
|
419
|
+
The +rake db:migrate+ command needs to be run here to ensure that our application has the +users+ table for future use.
|
420
|
+
|
421
|
+
Also to keep it simple, the posts form will have a new text field called +author_name_+ where users can elect to put their name. The engine will then take this name and create a new +User+ object from it or find one that already has that name, and then associate the post with it.
|
422
|
+
|
423
|
+
First, the +author_name+ text field needs to be added to the +app/views/blorgh/posts/_form.html.erb+ partial inside the engine. This can be added above the +title+ field with this code:
|
424
|
+
|
425
|
+
<erb>
|
426
|
+
<div class="field">
|
427
|
+
<%= f.label :author_name %><br />
|
428
|
+
<%= f.text_field :author_name %>
|
429
|
+
</div>
|
430
|
+
</erb>
|
431
|
+
|
432
|
+
The +Blorgh::Post+ model should then have some code to convert the +author_name+ field into an actual +User+ object and associate it as that post's +author+ before the post is saved. It will also need to have an +attr_accessor+ setup for this field so that the setter and getter methods are defined for it.
|
433
|
+
|
434
|
+
To do all this, you'll need to add the +attr_accessor+ for +author_name+, the association for the author and the +before_save+ call into +app/models/blorgh/post.rb+. The +author+ association will be hard-coded to the +User+ class for the time being.
|
435
|
+
|
436
|
+
<ruby>
|
437
|
+
attr_accessor :author_name
|
438
|
+
belongs_to :author, :class_name => "User"
|
439
|
+
|
440
|
+
before_save :set_author
|
441
|
+
|
442
|
+
private
|
443
|
+
def set_author
|
444
|
+
self.author = User.find_or_create_by_name(author_name)
|
445
|
+
end
|
446
|
+
</ruby>
|
447
|
+
|
448
|
+
By defining that the +author+ association's object is represented by the +User+ class a link is established between the engine and the application. There needs to be a way of associating the records in the +blorgh_posts+ table with the records in the +users+ table. Because the association is called +author+, there should be an +author_id+ column added to the +blorgh_posts+ table.
|
449
|
+
|
450
|
+
To generate this new column, run this command within the engine:
|
451
|
+
|
452
|
+
<shell>
|
453
|
+
$ rails g migration add_author_id_to_blorgh_posts author_id:integer
|
454
|
+
</shell>
|
455
|
+
|
456
|
+
NOTE: Due to the migration's name and the column specification after it, Rails will automatically know that you want to add a column to a specific table and write that into the migration for you. You don't need to tell it any more than this.
|
457
|
+
|
458
|
+
This migration will need to be run on the application. To do that, it must first be copied using this command:
|
459
|
+
|
460
|
+
<shell>
|
461
|
+
$ rake blorgh:install:migrations
|
462
|
+
</shell>
|
463
|
+
|
464
|
+
Notice here that only _one_ migration was copied over here. This is because the first two migrations were copied over the first time this command was run.
|
465
|
+
|
466
|
+
<shell>
|
467
|
+
NOTE: Migration [timestamp]_create_blorgh_posts.rb from blorgh has been skipped. Migration with the same name already exists.
|
468
|
+
NOTE: Migration [timestamp]_create_blorgh_comments.rb from blorgh has been skipped. Migration with the same name already exists.
|
469
|
+
Copied migration [timestamp]_add_author_id_to_blorgh_posts.rb from blorgh
|
470
|
+
</shell>
|
471
|
+
|
472
|
+
Run this migration using this command:
|
473
|
+
|
474
|
+
<shell>
|
475
|
+
$ rake db:migrate
|
476
|
+
</shell>
|
477
|
+
|
478
|
+
Now with all the pieces in place, an action will take place that will associate an author -- represented by a record in the +users+ table -- with a post, represented by the +blorgh_posts+ table from the engine.
|
479
|
+
|
480
|
+
Finally, the author's name should be displayed on the post's page. Add this code above the "Title" output inside +app/views/blorgh/posts/show.html.erb+:
|
481
|
+
|
482
|
+
<erb>
|
483
|
+
<p>
|
484
|
+
<b>Author:</b>
|
485
|
+
<%= @post.author %>
|
486
|
+
</p>
|
487
|
+
</erb>
|
488
|
+
|
489
|
+
WARNING: For posts created previously, this will break the +show+ page for them. We recommend deleting these posts and starting again, or manually assigning an author using +rails c+.
|
490
|
+
|
491
|
+
By outputting +@post.author+ using the +<%=+ tag the +to_s+ method will be called on the object. By default, this will look quite ugly:
|
492
|
+
|
493
|
+
<text>
|
494
|
+
#<User:0x00000100ccb3b0>
|
495
|
+
</text>
|
496
|
+
|
497
|
+
This is undesirable and it would be much better to have the user's name there. To do this, add a +to_s+ method to the +User+ class within the application:
|
498
|
+
|
499
|
+
<ruby>
|
500
|
+
def to_s
|
501
|
+
name
|
502
|
+
end
|
503
|
+
</ruby>
|
504
|
+
|
505
|
+
Now instead of the ugly Ruby object output the author's name will be displayed.
|
506
|
+
|
507
|
+
h4. Configuring an engine
|
508
|
+
|
509
|
+
This section covers firstly how you can make the +user_class+ setting of the Blorgh engine configurable, followed by general configuration tips for the engine.
|
510
|
+
|
511
|
+
h5. Setting configuration settings in the application
|
512
|
+
|
513
|
+
The next step is to make the class that represents a +User+ in the application customizable for the engine. This is because, as explained before, that class may not always be +User+. To make this customizable, the engine will have a configuration setting called +user_class+ that will be used to specify what the class representing users is inside the application.
|
514
|
+
|
515
|
+
To define this configuration setting, you should use a +mattr_accessor+ inside the +Blorgh+ module for the engine, located at +lib/blorgh.rb+ inside the engine. Inside this module, put this line:
|
516
|
+
|
517
|
+
<ruby>
|
518
|
+
mattr_accessor :user_class
|
519
|
+
</ruby>
|
520
|
+
|
521
|
+
This method works like its brothers +attr_accessor+ and +cattr_accessor+, but provides a setter and getter method on the module with the specified name. To use it, it must be referenced using +Blorgh.user_class+.
|
522
|
+
|
523
|
+
The next step is switching the +Blorgh::Post+ model over to this new setting. For the +belongs_to+ association inside this model (+app/models/blorgh/post.rb+), it will now become this:
|
524
|
+
|
525
|
+
<ruby>
|
526
|
+
belongs_to :author, :class_name => Blorgh.user_class
|
527
|
+
</ruby>
|
528
|
+
|
529
|
+
The +set_author+ method also located in this class should also use this class:
|
530
|
+
|
531
|
+
<ruby>
|
532
|
+
self.author = Blorgh.user_class.constantize.find_or_create_by_name(author_name)
|
533
|
+
</ruby>
|
534
|
+
|
535
|
+
To set this configuration setting within the application, an initializer should be used. By using an initializer, the configuration will be set up before the application starts and makes references to the classes of the engine which may depend on this configuration setting existing.
|
536
|
+
|
537
|
+
Create a new initializer at +config/initializers/blorgh.rb+ inside the application where the +blorgh+ engine is installed and put this content in it:
|
538
|
+
|
539
|
+
<ruby>
|
540
|
+
Blorgh.user_class = "User"
|
541
|
+
</ruby>
|
542
|
+
|
543
|
+
WARNING: It's very important here to use the +String+ version of the class, rather than the class itself. If you were to use the class, Rails would attempt to load that class and then reference the related table, which could lead to problems if the table wasn't already existing. Therefore, a +String+ should be used and then converted to a class using +constantize+ in the engine later on.
|
544
|
+
|
545
|
+
Go ahead and try to create a new post. You will see that it works exactly in the same way as before, except this time the engine is using the configuration setting in +config/initializers/blorgh.rb+ to learn what the class is.
|
546
|
+
|
547
|
+
There are now no strict dependencies on what the class is, only what the class's API must be. The engine simply requires this class to define a +find_or_create_by_name+ method which returns an object of that class to be associated with a post when it's created.
|
548
|
+
|
549
|
+
h5. General engine configuration
|
550
|
+
|
551
|
+
Within an engine, there may come a time where you wish to use things such as initializers, internationalization or other configuration options. The great news is that these things are entirely possible because a Rails engine shares much the same functionality as a Rails application. In fact, a Rails application's functionality is actually a superset of what is provided by engines!
|
552
|
+
|
553
|
+
If you wish to use initializers (code that should run before the engine is loaded), the best place for them is the +config/initializers+ folder. This directory's functionality is explained in the "Initializers section":http://guides.rubyonrails.org/configuring.html#initializers of the Configuring guide.
|
554
|
+
|
555
|
+
For locales, simply place the locale files in the +config/locales+ directory, just like you would in an application.
|
556
|
+
|
557
|
+
h3. Extending engine functionality
|
558
|
+
|
559
|
+
This section looks at overriding or adding functionality to the views, controllers and models provided by an engine.
|
560
|
+
|
561
|
+
h4. Overriding views
|
562
|
+
|
563
|
+
When Rails looks for a view to render, it will first look in the +app/views+ directory of the application. If it cannot find the view there, then it will check in the +app/views+ directories of all engines which have this directory.
|
564
|
+
|
565
|
+
In the +blorgh+ engine, there is a currently a file at +app/views/blorgh/posts/index.html.erb+. When the engine is asked to render the view for +Blorgh::PostsController+'s +index+ action, it will first see if it can find it at +app/views/blorgh/posts/index.html.erb+ within the application and then if it cannot it will look inside the engine.
|
566
|
+
|
567
|
+
By overriding this view in the application, by simply creating a new file at +app/views/blorgh/posts/index.html.erb+, you can completely change what this view would normally output.
|
568
|
+
|
569
|
+
Try this now by creating a new file at +app/views/blorgh/posts/index.html.erb+ and put this content in it:
|
570
|
+
|
571
|
+
<erb>
|
572
|
+
<h1>Posts</h1>
|
573
|
+
<%= link_to "New Post", new_post_path %>
|
574
|
+
<% @posts.each do |post| %>
|
575
|
+
<h2><%= post.title %></h2>
|
576
|
+
<small>By <%= post.author %></small>
|
577
|
+
<%= simple_format(post.text) %>
|
578
|
+
<hr>
|
579
|
+
<% end %>
|
580
|
+
</erb>
|
581
|
+
|
582
|
+
Rather than looking like the default scaffold, the page will now look like this:
|
583
|
+
|
584
|
+
!images/engines_post_override.png(Engine scaffold overriden)!
|
585
|
+
|
586
|
+
h4. Controllers
|
587
|
+
|
588
|
+
TODO: Explain how to extend a controller.
|
589
|
+
IDEA: I like Devise's +devise :controllers => { "sessions" => "sessions" }+ idea. Perhaps we could incorporate that into the guide?
|
590
|
+
|
591
|
+
h4. Models
|
592
|
+
|
593
|
+
TODO: Explain how to extend models provided by an engine.
|
594
|
+
|
595
|
+
h4. Routes
|
596
|
+
|
597
|
+
Within the application, you may wish to link to some area within the engine. Due to the fact that the engine's routes are isolated (by the +isolate_namespace+ call within the +lib/blorgh/engine.rb+ file), you will need to prefix these routes with the engine name. This means rather than having something such as:
|
598
|
+
|
599
|
+
<erb>
|
600
|
+
<%= link_to "Blog posts", posts_path %>
|
601
|
+
</erb>
|
602
|
+
|
603
|
+
It needs to be written as:
|
604
|
+
|
605
|
+
<erb>
|
606
|
+
<%= link_to "Blog posts", blorgh.posts_path %>
|
607
|
+
</erb>
|
608
|
+
|
609
|
+
This allows for the engine _and_ the application to both have a +posts_path+ routing helper and to not interfere with each other. You may also reference another engine's routes from inside an engine using this same syntax.
|
610
|
+
|
611
|
+
If you wish to reference the application inside the engine in a similar way, use the +main_app+ helper:
|
612
|
+
|
613
|
+
<erb>
|
614
|
+
<%= link_to "Home", main_app.root_path %>
|
615
|
+
</erb>
|
616
|
+
|
617
|
+
TODO: Mention how to use assets within an engine?
|
618
|
+
TODO: Mention how to depend on external gems, like RedCarpet.
|