JSON 양식 ({:name => "hello"}
)과 같은 JSON을 레일즈 3 컨트롤러 ExampleController에 게시하고 있습니다.Rails 3 params unwanted wrapping
대신 같은 params
을 얻는 :
어떤 생각을
이{:name => "hello", :controller => "example", :action => "index", :example => {:name => "hello"}
(예 JSON 데이터가 두 번 표시와 행동과 컨트롤러가 추가됩니다!) :
{:name => "hello"}
나는군요 왜 ? 쉽게 클라이언트가 모델을 패키징 할 필요가 없습니다 의미 Example.create
또는 @example.update_attributes
로 매개 변수를 전달할 수 있도록
여기서 쓴대로 content-accept 및 Accepts 헤더를 설정하고 있습니까? http://stackoverflow.com/questions/4914745/post-json-to-rails-server –
예 - jQuery $ .ajax에서 게시 : 유형 : json – Blacksad