Last active
August 29, 2015 14:03
-
-
Save kidach1/32bad1993c7d8160f7a6 to your computer and use it in GitHub Desktop.
Gem、Railtieプラグイン、Engine(full/mountable)の違いとそれぞれの基礎情報 ref: http://qiita.com/kidachi_/items/565c2c077ae8d15fe3a8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pick the frameworks you want: | |
require "active_model/railtie" | |
require "active_record/railtie" | |
require "action_controller/railtie" | |
require "action_mailer/railtie" | |
require "action_view/railtie" | |
require "sprockets/railtie" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bundle gem <gem_name> -t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyPlugin | |
class Railtie < Rails::Railtie | |
# config.my_plugin = ... | |
# initializer "my_lugin.set_configs" ... | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rake routes | |
Prefix Verb URI Pattern Controller#Action | |
my_engine /my_engine MyEngine::Engine | |
Routes for MyEngine::Engine: | |
foo GET /foo(.:format) my_engine/bar#foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Rails | |
class Railtie | |
end | |
class Engine < Railtie | |
end | |
class Application < Engine | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails plugin new <plugin_name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails plugin new <engine_name> --full |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails plugin new <engine_name> --mountable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rake routes | |
Prefix Verb URI Pattern Controller#Action | |
foo GET /foo(.:format) bar#foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MyEngine::Engine.routes.draw do | |
get 'foo' => 'bar' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment