Skip to content

Instantly share code, notes, and snippets.

@amitpatelx
Last active December 18, 2015 15:29
Show Gist options
  • Save amitpatelx/5804273 to your computer and use it in GitHub Desktop.
Save amitpatelx/5804273 to your computer and use it in GitHub Desktop.
- flash.each do |name, msg|
%div{:class => "alert alert-#{name == :notice ? "success" : "error"}"}
%a.close{"data-dismiss" => "alert"} ×
= content_tag :div, msg, :id => "flash_#{name}" if msg.is_a?(String)
#main{:role => "main"}
.container
= render 'layouts/messages'
= yield
%h3 Edit Profile
.row-fluid
.span12
.full-graph
.padded
= form_for @user, url: update_profile_path, html: {class: 'form-horizontal'} do |f|
.control-group
%label.control-label First name
.controls
= f.text_field :first_name
def update
@user = current_user
if @user.update_attributes(params[:user])
flash[:notice] = "Profile updated successfully"
redirect_to profile_url
else
flash[:error] = @user.errors.full_messages.to_sentence
logger.error("*******************************#{@user.errors.full_messages.to_sentence}")
render :action => 'edit'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment