Last active
August 29, 2015 14:19
-
-
Save guiltry/fbcd99f9bc448454e070 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
end | |
class Knight < User | |
end | |
class Archer < User | |
end | |
class UserController < ApplicationController | |
def create | |
@user = User.new(user_params) | |
if user_params[:type] == "Knight" | |
@user.increase_strength(10) | |
@user.decrease_agility(4) | |
elsif user_params[:type] == "Archer" | |
@user.decrease_strength(6) | |
@user.increase_agility(8) | |
end | |
# ... | |
end | |
end | |
class Admin::UserController < ApplicationController | |
def create | |
@user = User.new(user_params) | |
if user_params[:type] == "Knight" | |
@user.increase_strength(10) | |
@user.decrease_agility(4) | |
elsif user_params[:type] == "Archer" | |
@user.decrease_strength(6) | |
@user.increase_agility(8) | |
end | |
# ... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment