2011-03-06 18:28:00 +00:00
|
|
|
class UsersController < Devise::RegistrationsController
|
2011-03-27 19:44:15 +00:00
|
|
|
def edit
|
2011-04-04 01:20:52 +00:00
|
|
|
render("edit", :layout => "info_window")
|
2011-03-27 19:44:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
if resource.update_with_password(params[resource_name])
|
2011-04-04 01:20:52 +00:00
|
|
|
sign_in(resource_name, resource, :bypass => true)
|
2011-09-15 01:35:22 +00:00
|
|
|
flash[:notice] = "Profile updated!"
|
2011-05-31 11:12:02 +00:00
|
|
|
redirect_to(:controller => "info_window", :action => "index", :hydrant_id => params[:hydrant_id])
|
2011-03-27 19:44:15 +00:00
|
|
|
else
|
|
|
|
clean_up_passwords(resource)
|
2011-05-15 23:33:32 +00:00
|
|
|
render(:json => {"errors" => resource.errors}, :status => 500)
|
2011-03-27 19:44:15 +00:00
|
|
|
end
|
|
|
|
end
|
2011-03-06 18:28:00 +00:00
|
|
|
|
|
|
|
def create
|
|
|
|
build_resource
|
|
|
|
if resource.save
|
2011-05-08 08:29:21 +00:00
|
|
|
sign_in(resource_name, resource)
|
|
|
|
render(:json => resource)
|
2011-03-06 18:28:00 +00:00
|
|
|
else
|
|
|
|
clean_up_passwords(resource)
|
2011-05-15 23:33:32 +00:00
|
|
|
render(:json => {"errors" => resource.errors}, :status => 500)
|
2011-03-06 18:28:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|