Strange AbstractController::ActionNotFound Error with update method in Rails

后端 未结 2 1454
走了就别回头了
走了就别回头了 2021-01-16 01:22

I have FamiliesController with these actions:

def edit
 @family=Family.find(params[:id])
end

def update
    @family=Family.find(params[:i         


        
相关标签:
2条回答
  • 2021-01-16 01:42

    I moved the

    resources :families

    to top of the routes.rb. And now it works fine.

    Don't no why it is so.

    0 讨论(0)
  • 2021-01-16 01:56

    Rails does not support alphanumeric IDs by default, it expects an integer.

    If you need to make the IDs alphanumeric, you need to make some changes. Please look at the following resources:

    • Altering the primary key in Rails to be a string

    • http://railscasts.com/episodes/63-model-name-in-url-revised

    • http://railscasts.com/episodes/314-pretty-urls-with-friendlyid

    0 讨论(0)
提交回复
热议问题