开发者

What variable should I pass here?

开发者 https://www.devze.com 2023-02-19 19:48 出处:网络
I have a profile model and a user has_one profile. Also, the profile is a nested re开发者_开发问答source inside the user resource. I\'m creating an edit.html.erb form for the profile view. What variab

I have a profile model and a user has_one profile. Also, the profile is a nested re开发者_开发问答source inside the user resource. I'm creating an edit.html.erb form for the profile view. What variable should I be passing to the form in this line:

<%= form_for(????) do |f| %>

By the way, this is my edit method in the profiles controller:

def edit
  @user = current_user
  @profile = @user.profiles.find(params[:id])
end


In your view:

<%= form_for([@user, @profile]) do |f|  %>
0

精彩评论

暂无评论...
验证码 换一张
取 消