Class | Admin::PeopleController
In: | app/controllers/admin/people_controller.rb
Parent: | Admin::BaseController

### Methods

change_status destroy index update

### Public Instance methods

change_status()

[Source]

        # File app/controllers/admin/people_controller.rb, line 37
    37:   def change_status
    38:     @person = Person.find(params[:id])
    39:     if @person.user.update_attribute(:status, params[:status])
    40:       render :update do |page|
    41:         page.replace "person-#{@person.id}", :partial => 'person', :object => @person
    42:       end
    43:     else
    44:       render :update do |page|
    45:         page.alert 'El estado no se ha cambiado'
    46:       end
    47:     end
    48:   end

destroy()

[Source]

        # File app/controllers/admin/people_controller.rb, line 50
    50:   def destroy
    51:     @person = Person.find(params[:id])
    52:     if @person.destroy
    53:       flash[:notice] = "El usuario ha sido eliminado"
    54:       redirect_to admin_people_path
    55:     else
    56:       flash[:error] = "No se ha podido eliminar el usuario"
    57:       redirect_to admin_people_path
    58:     end
    59:   end

index()

[Source]

        # File app/controllers/admin/people_controller.rb, line 5
     5:   def index
     6:     conditions = params[:q] ? "people.name||last_names ilike '%#{params[:q]}%'" : nil
     7:     @people = Person.paginate :page => params[:page],
     8:       :include => :user, :conditions => conditions,
     9:       :order => "users.status, people.name||last_names"
    10:   end

update()

[Source]

        # File app/controllers/admin/people_controller.rb, line 12
    12:   def update
    13:     @person = Person.find(params[:id])
    14:     respond_to do |format|
    15:       if @person.update_attributes(params[:person])
    16:         format.html {
    17:           flash[:notice] = 'Los datos se han guardado correctamente'
    18:           redirect_to admin_person_path(@person)
    19:         }
    20:         format.js {
    21:           render :update do |page|
    22:             page.replace "person-#{@person.id}", :partial => 'person', :object => @person
    23:           end
    24:         }
    25:       else
    26:         format.html { render :action => "new" }
    27:         format.js {
    28:           render :update do |page|
    29:             page.alert 'El estado no se ha cambiado'
    30:           end
    31:         }
    32:       end
    33:     end
    34:
    35:   end

[Validate]