Rails Engine

Rails関連のメモ

URLの解決

  • rails routes
$ bundle exec rails routes

    Prefix Verb   URI Pattern                  Controller#Action
   trestle        /admin                       Trestle::Engine
   members GET    /members(.:format)           members#index
    member GET    /members/:id(.:format)       members#show

この例では trestle がサブアプリ

  • <%= link_to "Home", main_app.member_path %>
  • <%= link_to "users", trestle.root_path %>