Я хочу сделать пользовательское действие для обновления информации моей учетной записи.Эта wiki была очень полезной, но я получаю ошибку ActionController::UnknownFormat in UsersController#account
при выборе варианта 3.
Мои маршруты выглядят так:
devise_for :users, :controllers => {
registrations: 'users/registrations',
sessions: 'users/sessions',
passwords: 'users/passwords',
confirmations: 'users/confirmations',
unlocks: 'users/unlocks'
}
resource :user, only: [:edit], path: "settings" do
member do
get 'account'
get 'password'
patch 'update_account'
patch 'update_password'
end
end
И затемконтроллер, который они устанавливают, выглядит следующим образом:
class UsersController < ApplicationController
before_action :authenticate_user!
def account
@user = current_user
end
end
rake routes
выглядит так:
account_user GET /settings/account(.:format) users#account
И когда я перехожу на localhost: 3000 / settings / account (гдеУ меня есть account.html.erb файл), я получаю эту ошибку: UsersController#account is missing a template for this request format and variant. request.formats: ["text/html"] request.variant: [] NOTE! For XHR/Ajax or API requests, this action would normally respond with 204 No Content: an empty white screen. Since you're loading it in a web browser, we assume that you expected to actually render a template, not… nothing, so we're showing an error to be extra-clear. If you expect 204 No Content, carry on. That's what you'll get from an XHR or API request. Give it a shot.
Почему?