Model Naming:
Table line_items
File app/models/line_item.rb
URL http://../store/list
File app/controllers/store_controller.rb
Class StoreController
Method list
URL http://../store/list
File app/views/store/list.html.erb (or .builder)
Helper module StoreHelper
# ...
Table line_items
File app/models/line_item.rb
Class LineItem
URL http://../store/list
File app/controllers/store_controller.rb
Class StoreController
Method list
Layout app/views/layouts/store.html.erb
URL http://../store/list
File app/views/store/list.html.erb (or .builder)
Helper module StoreHelper
File app/helpers/store_helper.rb
app/controller/下两个目录同名的controller 通过两个不同的目录来区别命名空间:
1.app/controller/admin/book_controller.rb(生成控制器命令:rails generate controller Admin::Book action1 action2 ... )
# ...
end
2.app/controller/content/book_controller.rb
class Content::BookController < ActionController::Base
# ...
end