lmarburger (owner)

Revisions

gist: 234751 Download_button fork
public
Public Clone URL: git://gist.github.com/234751.git
Embed All Files: show embed
accounts_controller.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class AccountsController < InheritedResources::Base
 
  actions :show, :new, :create, :edit, :update
  defaults :resource_class => Person, :instance_name => 'person'
 
  before_filter :authenticate, :except => [ :new, :create ]
 
  def create
    create! do |format|
      format.html { redirect_to root_url }
      format.json { render :json => true }
    end
  end
 
  private
 
    def resource
      @current_person
    end
 
    def create_resource(object)
      # Don't require a password confirmation using JSON.
      object.password_confirmation = object.password if request.format.json?
 
      object.save
    end
 
end