0
在Rails的4 duvid方法set_x,因爲創建一個名爲 「get_json」如何忽略行動的Rails 4.0創建自定義操作
def get_json
@step_recipes = StepRecipe.all
respond_to do |format|
format.json render: @step_recipes
end
end
自定義操作,並且將其添加到路線:
get "step_recipes/get_json" => "step_recipes#get_json"
問題是白衣Rails中4回調,因爲我嘗試打開這條路線,並得到錯誤Couldn't find StepRecipe with id=get_json
,並有這樣的:
Parameters:
{"id"=>"get_json"}
我想現在我怎麼忽略這個方法在控制器set_x,如何創建自定義操作,並沒有問題惠普呢?非常感謝。