i just can not figure out the best way to handle the routes / controller with the following namespace.
i′d just like to have the following setup:
.../manage/rooms/ ( <%= @ rooms.number_of_rooms%>, <%= @ rooms.title %> )
.../manage/fuu/ ( <%= @ fuu.id %>...)
..manage/foo/ ...
i know this is done by
routes.rb
namespace :manage do
resources :rooms, :fuu, :foo
end
and under ...controller/manage/rooms_controller.rb
and fuu_controller.rb
and foo...
example:
class Manage::RoomsController < ApplicationController
index
@rooms = Rooms.all
end
def create
@room = Room.new(room_params)
if @room.save
redirect_to [:manage, @room]
else
render 'new'
end
...
end
and a controller under controller/manage_controller.rb
class ManageController < ApplicationController
end
so here is my question i do like to use all of my forms and variables @rooms.title...
who are under .../manage/rooms/ .../manage/fuu/ ....
under the .../manage/index.html.erb
is the best way to do it via the controller e.g. render partial or changing the controller which the routes point to?
thanks!!!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…