У меня есть две модели профилей и пользователей в моей форме. После того, как пользователь создан, он может перейти к редактированию своего профиля. Взгляды работают хорошо. Но когда я нажимаю Сохранить, чтобы обновить отредактированный профиль. Он не обновляется, но во флэш-уведомлении отображается, что профиль был обновлен. Что может быть не так? Я не уверен, что пошло не так. Ниже приведен код.
class ProfilesController < ApplicationController
def new
#@user.profile = Profile.new
@user = User.find(current_user.id)
@identity = @user.profile || @user.build_profile()
@identity.save
end
def update
@user = current_user
@identity = @user.profile
if @identity.update_attributes(params[:identity])
flash[:notice] = 'Profile was successfully updated.'
redirect_to(new_profile_path())
else
render :action => "new"
end
end
end
class UsersController < ApplicationController
def show
@user = current_user
@user = User.find(params[:id])
@identity = @user.profile || @user.build_profile()
@identity.save
end
......
end
Спасибо за вашу помощь.