我写的..
rails new testapp
cd testapp/
rails plugin new blog --mountable
cd blog/
rails g scaffold post name description:text
rake db:migrate
cd ../
rails s
转到 localhost:3000/blog/posts/index,我收到错误“没有路由匹配 [GET]”/blog/posts/index“”
我做错了什么?
我写的..
rails new testapp
cd testapp/
rails plugin new blog --mountable
cd blog/
rails g scaffold post name description:text
rake db:migrate
cd ../
rails s
转到 localhost:3000/blog/posts/index,我收到错误“没有路由匹配 [GET]”/blog/posts/index“”
我做错了什么?
Putting the engine at some random directory inside your application won't make it magically work. I don't know where you learned this technique from, but it is wrong.
You should put the engine outside your application and require it into your application's Gemfile, like this:
gem 'blog', :path => '../blog'
Then the engine will be automatically loaded by Rails.
The Engines Guide goes into more detail. I highly recommend reading that.