Ruby on Rails Monday, November 3, 2014

sampath n. wrote in post #1161624:
> Form_for will get the :id by default. which version are you using and
> please paste the controller code here. tks
>
> On Mon, Nov 3, 2014 at 10:16 AM, BalaRaju Vankala
> <foreverbala4u@gmail.com>

Rails 4.0.3

Controller code:
def edit
@banner_title = "Edit Profile"
@profile = Profile.find(current_user.id)
end

def update
@profile = Profile.find(current_user.id)
respond_to do |format|
if @profile.update_attributes(params[:profile])
format.html { redirect_to user_url, notice: 'Profile was
successfully updated.' }
format.json { head :ok }
else
@title = "Edit profile"
format.html { render action: "edit" }
format.json { render json: @subject.errors, status:
:unprocessable_entity }
end
end
end

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/67dc29be33393146b88d81b83f7161f4%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment