プラグインの作成

新しいプラグインを作ります。

$ rails plugin new your_plugin_name --full
$ cd your_plugin_name
$ rails g scaffold Blog title:string body:text

アプリケーションを起動します。

$ rake db:migrate
$ ruby test/dummy/script/rails s

http://localhost:3000/blogs にアクセスしてください。

起動を確認したら、Ctrl + Cでアプリケーションを終了します。

Enjuのディレクトリに移動し、Gemfileを編集します。

$ cd ../your_enju_leaf
$ vi Gemfile

プラグインを読み込みます。

gem 'your_plugin_name', :path => '../your_plugin_name'

プラグインで使用するデータベースを作成します。

$ bundle update
$ rake your_plugin_name_engine:install:migrations RAILS_ENV=production
$ rake db:migrate RAILS_ENV=production

Enjuを再起動します。この例では http://localhost:3000/blogs にアクセスしてください。


編集ログイン 最終更新のRSS