我有几个链接:
<%= link_to "", '../captures#photos' %>
<%= link_to "", '../captures#videos' %>
<%= link_to "", '../captures#audios' %>
它们传递给 captures_controller.rb
如何解析参数(照片/视频/音频)以防止在控制器中编制索引?
目前在控制器中我有:
def photos
logger.debug 'photos'
end
def videos
logger.debug 'videos'
end
def audios
logger.debug 'audios'
end
def index
logger.debug 'index'
end
但是以下所有网址都记录“索引”?
- .../捕获
- .../捕获#照片
- .../捕捉#视频
- .../捕获#audios
路线.rb:
# these were when I was trying the links without the hashes
match 'captures/photos' => 'captures#photos'
match 'captures/videos' => 'captures#videos'
match 'captures/audios' => 'captures#audios'
resources :captures
resources :photos
resources :audios
resources :videos