request.method
는 :get
, :put
등과 같은 기호를 반환한다고 생각하십니까? 대신 컨트롤러 동작에서 GET
을 문자열로 가져옵니다!`request.method`가 (기호 대신) 문자열을 반환하는 이유는 무엇입니까?
내가 잘못 했나요? routes.rb
에서
:
resources :posts
member do
get 'some_action'
end
end
뷰 .erb 물 :
<%= link_to "Some Action",some_action_post_path %>
PostsController
물 :
def some_action
p request.method # => "GET"
p request.method.class.name # => "String"
if request.method == :get
#does not get called
end
end
시. Ruby 1.8.3 p330에서 레일즈 3.0.3을 사용하고 있습니다.
내가 잘못된 문서를 찾고 있었어요 :) – Zabba