Commit dc51f973 authored by Hermann Mayer's avatar Hermann Mayer
Browse files

[User Management] Merged user with player model to combine functionality....

[User Management] Merged user with player model to combine functionality. Added admin flag to player.
parent 9e2094cb
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
class RegistrationsController < Devise::RegistrationsController

  def edit
    @teams = Team.all  
    super
  end

  def update
    self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
    prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)

    resource.team = Team.find_by_id(params[:team][:team_id])
    @teams = Team.all  

    if resource.update_with_password(resource_params)
      if is_navigational_format?
        flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
          :update_needs_confirmation : :updated
        set_flash_message :notice, flash_key
      end
      sign_in resource_name, resource, :bypass => true
      respond_with resource, :location => after_update_path_for(resource)
    else
      clean_up_passwords resource
      respond_with resource
    end
  end

end
+0 −11
Original line number Diff line number Diff line
class UsersController < ApplicationController
  # GET /users
  # GET /users.json
  def index

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @teams }
    end
  end
end
+2 −0
Original line number Diff line number Diff line
module RegistrationsHelper
end

app/helpers/user_helper.rb

deleted100644 → 0
+0 −2
Original line number Diff line number Diff line
module UserHelper
end
+9 −1
Original line number Diff line number Diff line
class Player < ActiveRecord::Base
  # :token_authenticatable, :confirmable,
  # :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable

  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :password, :password_confirmation, :remember_me, :name

  belongs_to :team
  attr_accessible :name
  # attr_accessible :name
end
Loading