Add all the basic models
This commit is contained in:
parent
6a36a7e61c
commit
da3d78a32a
95 changed files with 1098 additions and 12 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -18,3 +18,4 @@
|
|||
|
||||
# mine
|
||||
.env
|
||||
erd.pdf
|
||||
|
|
1
Gemfile
1
Gemfile
|
@ -26,5 +26,6 @@ group :development do
|
|||
gem 'quiet_assets'
|
||||
gem 'web-console', '~> 2.0'
|
||||
gem 'spring'
|
||||
gem 'rails-erd'
|
||||
end
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ GEM
|
|||
sass (>= 3.3.0)
|
||||
builder (3.2.2)
|
||||
byebug (6.0.2)
|
||||
choice (0.2.0)
|
||||
coderay (1.1.0)
|
||||
coffee-rails (4.1.0)
|
||||
coffee-script (>= 2.2.0)
|
||||
|
@ -134,6 +135,11 @@ GEM
|
|||
activesupport (>= 4.2.0.beta, < 5.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails-erd (1.4.3)
|
||||
activerecord (>= 3.2)
|
||||
activesupport (>= 3.2)
|
||||
choice (~> 0.2.0)
|
||||
ruby-graphviz (~> 1.2)
|
||||
rails-html-sanitizer (1.0.2)
|
||||
loofah (~> 2.0)
|
||||
railties (4.2.4)
|
||||
|
@ -143,6 +149,7 @@ GEM
|
|||
thor (>= 0.18.1, < 2.0)
|
||||
rake (10.4.2)
|
||||
rdoc (4.2.0)
|
||||
ruby-graphviz (1.2.2)
|
||||
sass (3.4.18)
|
||||
sass-rails (5.0.4)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
|
@ -202,6 +209,7 @@ DEPENDENCIES
|
|||
omniauth-reddit!
|
||||
quiet_assets
|
||||
rails (= 4.2.4)
|
||||
rails-erd
|
||||
sass-rails (~> 5.0)
|
||||
sdoc (~> 0.4.0)
|
||||
simple_form
|
||||
|
|
3
app/assets/javascripts/awaken_types.coffee
Normal file
3
app/assets/javascripts/awaken_types.coffee
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
3
app/assets/javascripts/cards.coffee
Normal file
3
app/assets/javascripts/cards.coffee
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
3
app/assets/javascripts/characters.coffee
Normal file
3
app/assets/javascripts/characters.coffee
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
@ -1,2 +0,0 @@
|
|||
$ ->
|
||||
$(".button-collapse").sideNav()
|
3
app/assets/javascripts/leader_skills.coffee
Normal file
3
app/assets/javascripts/leader_skills.coffee
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
3
app/assets/javascripts/passive_skills.coffee
Normal file
3
app/assets/javascripts/passive_skills.coffee
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
3
app/assets/javascripts/rarities.coffee
Normal file
3
app/assets/javascripts/rarities.coffee
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
3
app/assets/javascripts/super_attacks.coffee
Normal file
3
app/assets/javascripts/super_attacks.coffee
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
3
app/assets/javascripts/types.coffee
Normal file
3
app/assets/javascripts/types.coffee
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
3
app/assets/stylesheets/awaken_types.scss
Normal file
3
app/assets/stylesheets/awaken_types.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the AwakenTypes controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
3
app/assets/stylesheets/cards.scss
Normal file
3
app/assets/stylesheets/cards.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the Cards controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
3
app/assets/stylesheets/characters.scss
Normal file
3
app/assets/stylesheets/characters.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the Character controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
3
app/assets/stylesheets/leader_skills.scss
Normal file
3
app/assets/stylesheets/leader_skills.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the LeaderSkills controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
3
app/assets/stylesheets/passive_skills.scss
Normal file
3
app/assets/stylesheets/passive_skills.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the PassiveSkills controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
3
app/assets/stylesheets/rarities.scss
Normal file
3
app/assets/stylesheets/rarities.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the Rarities controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
3
app/assets/stylesheets/super_attacks.scss
Normal file
3
app/assets/stylesheets/super_attacks.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the SuperAttacks controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
3
app/assets/stylesheets/types.scss
Normal file
3
app/assets/stylesheets/types.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the Types controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
51
app/controllers/awaken_types_controller.rb
Normal file
51
app/controllers/awaken_types_controller.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
class AwakenTypesController < ApplicationController
|
||||
before_action :set_awaken_type, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@awaken_types = AwakenType.all
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
@awaken_type = AwakenType.new
|
||||
end
|
||||
|
||||
def create
|
||||
@awaken_type = AwakenType.new(awaken_type_params)
|
||||
|
||||
if @awaken_type.save
|
||||
redirect_to awaken_types_path, notice: 'Awaken Type was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @awaken_type.update(awaken_type_params)
|
||||
redirect_to awaken_types_path, notice: 'Awaken Type was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@awaken_type.destroy
|
||||
|
||||
redirect_to awaken_types_path, notice: 'Awaken Type was deleted'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def awaken_type_params
|
||||
params.require(:awaken_type).permit(:name)
|
||||
end
|
||||
|
||||
def set_awaken_type
|
||||
@awaken_type = AwakenType.find(params[:id])
|
||||
end
|
||||
end
|
54
app/controllers/cards_controller.rb
Normal file
54
app/controllers/cards_controller.rb
Normal file
|
@ -0,0 +1,54 @@
|
|||
class CardsController < ApplicationController
|
||||
before_action :set_card, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@cards = Card.all
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
@card = Card.new
|
||||
end
|
||||
|
||||
def create
|
||||
@card = Card.new(card_params)
|
||||
|
||||
if @card.save
|
||||
redirect_to cards_path, notice: 'Card was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @card.update(card_params)
|
||||
redirect_to cards_path, notice: 'Card was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@card.destroy
|
||||
|
||||
redirect_to cards_path, notice: 'Card was deleted'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def card_params
|
||||
params.require(:card).permit(:prefix, :character_id, :rarity_id, :type_id,
|
||||
:leader_skill_id, :passive_skill_id,
|
||||
:super_attack_id, :dokkan_id, :gameid,
|
||||
:awaken_type_id, link_ids: [])
|
||||
end
|
||||
|
||||
def set_card
|
||||
@card = Card.find(params[:id])
|
||||
end
|
||||
end
|
51
app/controllers/characters_controller.rb
Normal file
51
app/controllers/characters_controller.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
class CharactersController < ApplicationController
|
||||
before_action :set_character, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@characters = Character.all
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
@character = Character.new
|
||||
end
|
||||
|
||||
def create
|
||||
@character = Character.new(character_params)
|
||||
|
||||
if @character.save
|
||||
redirect_to characters_path, notice: 'Character was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @character.update(character_params)
|
||||
redirect_to characters_path, notice: 'Character was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@character.destroy
|
||||
|
||||
redirect_to characters_path, notice: 'Character was deleted'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def character_params
|
||||
params.require(:character).permit(:name)
|
||||
end
|
||||
|
||||
def set_character
|
||||
@character = Character.find(params[:id])
|
||||
end
|
||||
end
|
51
app/controllers/leader_skills_controller.rb
Normal file
51
app/controllers/leader_skills_controller.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
class LeaderSkillsController < ApplicationController
|
||||
before_action :set_leader_skill, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@leader_skills = LeaderSkill.all
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
@leader_skill = LeaderSkill.new
|
||||
end
|
||||
|
||||
def create
|
||||
@leader_skill = LeaderSkill.new(leader_skill_params)
|
||||
|
||||
if @leader_skill.save
|
||||
redirect_to leader_skills_path, notice: 'Leader Skill was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @leader_skill.update(leader_skill_params)
|
||||
redirect_to leader_skills_path, notice: 'Leader Skill was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@leader_skill.destroy
|
||||
|
||||
redirect_to leader_skills_path, notice: 'Leader Skills was deleted'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def leader_skill_params
|
||||
params.require(:leader_skill).permit(:name, :description)
|
||||
end
|
||||
|
||||
def set_leader_skill
|
||||
@leader_skill = LeaderSkill.find(params[:id])
|
||||
end
|
||||
end
|
51
app/controllers/passive_skills_controller.rb
Normal file
51
app/controllers/passive_skills_controller.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
class PassiveSkillsController < ApplicationController
|
||||
before_action :set_passive_skill, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@passive_skills = PassiveSkill.all
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
@passive_skill = PassiveSkill.new
|
||||
end
|
||||
|
||||
def create
|
||||
@passive_skill = PassiveSkill.new(passive_skill_params)
|
||||
|
||||
if @passive_skill.save
|
||||
redirect_to passive_skills_path, notice: 'Passive Skill was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @passive_skill.update(passive_skill_params)
|
||||
redirect_to passive_skills_path, notice: 'Passive Skill was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@passive_skill.destroy
|
||||
|
||||
redirect_to passive_skills_path, notice: 'Passive Skill was deleted'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def passive_skill_params
|
||||
params.require(:passive_skill).permit(:name, :description)
|
||||
end
|
||||
|
||||
def set_passive_skill
|
||||
@passive_skill = PassiveSkill.find(params[:id])
|
||||
end
|
||||
end
|
51
app/controllers/rarities_controller.rb
Normal file
51
app/controllers/rarities_controller.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
class RaritiesController < ApplicationController
|
||||
before_action :set_rarity, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@rarities = Rarity.all
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
@rarity = Rarity.new
|
||||
end
|
||||
|
||||
def create
|
||||
@rarity = Rarity.new(rarity_params)
|
||||
|
||||
if @rarity.save
|
||||
redirect_to rarities_path, notice: 'Rarity was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @rarity.update(rarity_params)
|
||||
redirect_to rarities_path, notice: 'Rarity was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@rarity.destroy
|
||||
|
||||
redirect_to rarities_path, notice: 'Rarity was deleted'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def rarity_params
|
||||
params.require(:rarity).permit(:name, :description)
|
||||
end
|
||||
|
||||
def set_rarity
|
||||
@rarity = Rarity.find(params[:id])
|
||||
end
|
||||
end
|
51
app/controllers/super_attacks_controller.rb
Normal file
51
app/controllers/super_attacks_controller.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
class SuperAttacksController < ApplicationController
|
||||
before_action :set_super_attack, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@super_attacks = SuperAttack.all
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
@super_attack = SuperAttack.new
|
||||
end
|
||||
|
||||
def create
|
||||
@super_attack = SuperAttack.new(super_attack_params)
|
||||
|
||||
if @super_attack.save
|
||||
redirect_to super_attacks_path, notice: 'Super Attack was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @super_attack.update(super_attack_params)
|
||||
redirect_to super_attacks_path, notice: 'Super Attack was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@super_attack.destroy
|
||||
|
||||
redirect_to super_attacks_path, notice: 'Super Attack was deleted'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def super_attack_params
|
||||
params.require(:super_attack).permit(:name, :description)
|
||||
end
|
||||
|
||||
def set_super_attack
|
||||
@super_attack = SuperAttack.find(params[:id])
|
||||
end
|
||||
end
|
51
app/controllers/types_controller.rb
Normal file
51
app/controllers/types_controller.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
class TypesController < ApplicationController
|
||||
before_action :set_type, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@types = Type.all
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
@type = Type.new
|
||||
end
|
||||
|
||||
def create
|
||||
@type = Type.new(type_params)
|
||||
|
||||
if @type.save
|
||||
redirect_to types_path, notice: 'Type was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @type.update(type_params)
|
||||
redirect_to types_path, notice: 'Type was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@type.destroy
|
||||
|
||||
redirect_to types_path, notice: 'Type was deleted'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def type_params
|
||||
params.require(:type).permit(:name, :description)
|
||||
end
|
||||
|
||||
def set_type
|
||||
@type = Type.find(params[:id])
|
||||
end
|
||||
end
|
|
@ -16,6 +16,10 @@ module ApplicationHelper
|
|||
content_tag(:i, class: "glyphicon glyphicon-#{icon} " + classes) {}
|
||||
end
|
||||
|
||||
def login_path(provider)
|
||||
"/auth/#{provider.to_s}"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def bootstrap_classes
|
||||
|
|
2
app/helpers/awaken_types_helper.rb
Normal file
2
app/helpers/awaken_types_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module AwakenTypesHelper
|
||||
end
|
2
app/helpers/cards_helper.rb
Normal file
2
app/helpers/cards_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module CardsHelper
|
||||
end
|
2
app/helpers/characters_helper.rb
Normal file
2
app/helpers/characters_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module CharactersHelper
|
||||
end
|
2
app/helpers/leader_skills_helper.rb
Normal file
2
app/helpers/leader_skills_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module LeaderSkillsHelper
|
||||
end
|
2
app/helpers/passive_skills_helper.rb
Normal file
2
app/helpers/passive_skills_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module PassiveSkillsHelper
|
||||
end
|
2
app/helpers/rarities_helper.rb
Normal file
2
app/helpers/rarities_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module RaritiesHelper
|
||||
end
|
2
app/helpers/super_attacks_helper.rb
Normal file
2
app/helpers/super_attacks_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module SuperAttacksHelper
|
||||
end
|
2
app/helpers/types_helper.rb
Normal file
2
app/helpers/types_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module TypesHelper
|
||||
end
|
3
app/models/awaken_type.rb
Normal file
3
app/models/awaken_type.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class AwakenType < ActiveRecord::Base
|
||||
validates :name, presence: true
|
||||
end
|
27
app/models/card.rb
Normal file
27
app/models/card.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
class Card < ActiveRecord::Base
|
||||
belongs_to :character
|
||||
belongs_to :rarity
|
||||
belongs_to :type
|
||||
belongs_to :leader_skill
|
||||
belongs_to :passive_skill
|
||||
belongs_to :super_attack
|
||||
belongs_to :awaken_type
|
||||
has_one :dokkan_card, class_name: 'Card', foreign_key: :dokkan_id
|
||||
|
||||
has_and_belongs_to_many :links
|
||||
|
||||
delegate :name, to: :character, prefix: false
|
||||
|
||||
validates :prefix, presence: true
|
||||
validates :character, presence: true
|
||||
validates :gameid, presence: true,
|
||||
numericality: { only_integer: true },
|
||||
length: { is: 7 }
|
||||
validates :rarity, presence: true
|
||||
validates :type, presence: true
|
||||
validates :awaken_type, presence: true
|
||||
|
||||
def dokkan?
|
||||
self.dokkan_id != nil
|
||||
end
|
||||
end
|
4
app/models/cards_link.rb
Normal file
4
app/models/cards_link.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
class CardsLink < ActiveRecord::Base
|
||||
belongs_to :card
|
||||
belongs_to :link
|
||||
end
|
4
app/models/character.rb
Normal file
4
app/models/character.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
class Character < ActiveRecord::Base
|
||||
validates :name, presence: true,
|
||||
uniqueness: { case_sensitive: false }
|
||||
end
|
4
app/models/leader_skill.rb
Normal file
4
app/models/leader_skill.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
class LeaderSkill < ActiveRecord::Base
|
||||
validates :name, presence: true
|
||||
validates :description, presence: true
|
||||
end
|
|
@ -1,4 +1,6 @@
|
|||
class Link < ActiveRecord::Base
|
||||
has_and_belongs_to_many :cards
|
||||
|
||||
validates :name, presence: true,
|
||||
uniqueness: true
|
||||
end
|
||||
|
|
2
app/models/medal.rb
Normal file
2
app/models/medal.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
class Medal < ActiveRecord::Base
|
||||
end
|
4
app/models/passive_skill.rb
Normal file
4
app/models/passive_skill.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
class PassiveSkill < ActiveRecord::Base
|
||||
validates :name, presence: true
|
||||
validates :description, presence: true
|
||||
end
|
5
app/models/rarity.rb
Normal file
5
app/models/rarity.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class Rarity < ActiveRecord::Base
|
||||
validates :name, presence: true,
|
||||
uniqueness: { case_sensitive: false }
|
||||
validates :description, presence: true
|
||||
end
|
4
app/models/super_attack.rb
Normal file
4
app/models/super_attack.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
class SuperAttack < ActiveRecord::Base
|
||||
validates :name, presence: true
|
||||
validates :description, presence: true
|
||||
end
|
5
app/models/type.rb
Normal file
5
app/models/type.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class Type < ActiveRecord::Base
|
||||
validates :name, presence: true,
|
||||
uniqueness: { case_sensitive: false }
|
||||
validates :description, presence: true
|
||||
end
|
|
@ -9,8 +9,26 @@
|
|||
= link_to 'DBZDokkan', root_path, class: 'navbar-brand'
|
||||
.collapse.navbar-collapse
|
||||
ul.nav.navbar-nav.navbar-right
|
||||
li= nav_link_to 'Links', links_path
|
||||
li.dropdown
|
||||
a href='#' class='dropdown-toggle' data-toggle='dropdown'
|
||||
= 'Abilities '
|
||||
span class='caret'
|
||||
ul.dropdown-menu
|
||||
li= link_to 'Links', links_path
|
||||
li= link_to 'Leader Skills', leader_skills_path
|
||||
li= link_to 'Passive Skills', passive_skills_path
|
||||
li= link_to 'Super Attacks', super_attacks_path
|
||||
li= nav_link_to 'Cards', cards_path
|
||||
li= nav_link_to 'Characters', characters_path
|
||||
li.dropdown
|
||||
a href='#' class='dropdown-toggle' data-toggle='dropdown'
|
||||
= 'Others '
|
||||
span class='caret'
|
||||
ul.dropdown-menu
|
||||
li= link_to 'Awaken Types', awaken_types_path
|
||||
li= link_to 'Rarities', rarities_path
|
||||
li= link_to 'Types', types_path
|
||||
- if logged_in?
|
||||
li= link_to 'Log Out', logout_path, method: :delete
|
||||
- else
|
||||
li= link_to 'Log In', '/auth/reddit'
|
||||
li= link_to 'Log In', login_path(:reddit)
|
||||
|
|
5
app/views/awaken_types/_form.html.slim
Normal file
5
app/views/awaken_types/_form.html.slim
Normal file
|
@ -0,0 +1,5 @@
|
|||
= simple_form_for @awaken_type do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
.form-actions
|
||||
= f.button :button
|
1
app/views/awaken_types/edit.html.slim
Normal file
1
app/views/awaken_types/edit.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
23
app/views/awaken_types/index.html.slim
Normal file
23
app/views/awaken_types/index.html.slim
Normal file
|
@ -0,0 +1,23 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Awaken Type', new_awaken_type_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
table.table.table-striped.table-hover
|
||||
thead
|
||||
tr
|
||||
th Name
|
||||
th Actions
|
||||
tbody
|
||||
- @awaken_types.each do |awaken_type|
|
||||
tr
|
||||
td= awaken_type.name
|
||||
td
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_awaken_type_path(awaken_type)
|
||||
= link_to glyph('trash', classes: 'control-icon'), awaken_type_path(awaken_type), method: :delete
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Awaken Type', new_awaken_type_path, class: 'btn btn-primary'
|
1
app/views/awaken_types/new.html.slim
Normal file
1
app/views/awaken_types/new.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
31
app/views/cards/_form.html.slim
Normal file
31
app/views/cards/_form.html.slim
Normal file
|
@ -0,0 +1,31 @@
|
|||
= simple_form_for @card do |f|
|
||||
.form-inputs
|
||||
.row
|
||||
.col-md-4
|
||||
= f.input :gameid, label: 'Game ID Number'
|
||||
.col-md-4
|
||||
= f.input :prefix
|
||||
.col-md-4
|
||||
= f.association :character
|
||||
.row
|
||||
.col-md-4
|
||||
= f.association :rarity
|
||||
.col-md-4
|
||||
= f.association :type
|
||||
.col-md-4
|
||||
= f.association :awaken_type
|
||||
.row
|
||||
.col-md-6
|
||||
= f.association :leader_skill
|
||||
.col-md-6
|
||||
= f.association :passive_skill
|
||||
.row
|
||||
.col-md-6
|
||||
= f.association :super_attack
|
||||
.row
|
||||
.col-md-12
|
||||
= f.label :links
|
||||
div
|
||||
= f.association :links, as: :check_boxes, item_wrapper_tag: nil, item_label_class: 'checkbox-inline', label: false
|
||||
.form-actions
|
||||
= f.button :button
|
1
app/views/cards/edit.html.slim
Normal file
1
app/views/cards/edit.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
25
app/views/cards/index.html.slim
Normal file
25
app/views/cards/index.html.slim
Normal file
|
@ -0,0 +1,25 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Card', new_card_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
table.table.table-striped.table-hover
|
||||
thead
|
||||
tr
|
||||
th Prefix
|
||||
th Name
|
||||
th Actions
|
||||
tbody
|
||||
- @cards.each do |card|
|
||||
tr
|
||||
td= card.prefix
|
||||
td= card.name
|
||||
td
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_card_path(card)
|
||||
= link_to glyph('trash', classes: 'control-icon'), card_path(card), method: :delete
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Card', new_card_path, class: 'btn btn-primary'
|
1
app/views/cards/new.html.slim
Normal file
1
app/views/cards/new.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
5
app/views/characters/_form.html.slim
Normal file
5
app/views/characters/_form.html.slim
Normal file
|
@ -0,0 +1,5 @@
|
|||
= simple_form_for @character do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
.form-actions
|
||||
= f.button :button
|
1
app/views/characters/edit.html.slim
Normal file
1
app/views/characters/edit.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
23
app/views/characters/index.html.slim
Normal file
23
app/views/characters/index.html.slim
Normal file
|
@ -0,0 +1,23 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Character', new_character_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
table.table.table-striped.table-hover
|
||||
thead
|
||||
tr
|
||||
th Name
|
||||
th Actions
|
||||
tbody
|
||||
- @characters.each do |character|
|
||||
tr
|
||||
td= character.name
|
||||
td
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_character_path(character)
|
||||
= link_to glyph('trash', classes: 'control-icon'), character_path(character), method: :delete
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Character', new_character_path, class: 'btn btn-primary'
|
1
app/views/characters/new.html.slim
Normal file
1
app/views/characters/new.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
6
app/views/leader_skills/_form.html.slim
Normal file
6
app/views/leader_skills/_form.html.slim
Normal file
|
@ -0,0 +1,6 @@
|
|||
= simple_form_for @leader_skill do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
= f.input :description
|
||||
.form-actions
|
||||
= f.button :button
|
1
app/views/leader_skills/edit.html.slim
Normal file
1
app/views/leader_skills/edit.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
25
app/views/leader_skills/index.html.slim
Normal file
25
app/views/leader_skills/index.html.slim
Normal file
|
@ -0,0 +1,25 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Leader Skill', new_leader_skill_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
table.table.table-striped.table-hover
|
||||
thead
|
||||
tr
|
||||
th Name
|
||||
th Description
|
||||
th Actions
|
||||
tbody
|
||||
- @leader_skills.each do |leader_skill|
|
||||
tr
|
||||
td= leader_skill.name
|
||||
td= leader_skill.description
|
||||
td
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_leader_skill_path(leader_skill)
|
||||
= link_to glyph('trash', classes: 'control-icon'), leader_skill_path(leader_skill), method: :delete
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Leader Skill', new_leader_skill_path, class: 'btn btn-primary'
|
1
app/views/leader_skills/new.html.slim
Normal file
1
app/views/leader_skills/new.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
6
app/views/passive_skills/_form.html.slim
Normal file
6
app/views/passive_skills/_form.html.slim
Normal file
|
@ -0,0 +1,6 @@
|
|||
= simple_form_for @passive_skill do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
= f.input :description
|
||||
.form-actions
|
||||
= f.button :button
|
1
app/views/passive_skills/edit.html.slim
Normal file
1
app/views/passive_skills/edit.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
25
app/views/passive_skills/index.html.slim
Normal file
25
app/views/passive_skills/index.html.slim
Normal file
|
@ -0,0 +1,25 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Passive Skill', new_passive_skill_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
table.table.table-striped.table-hover
|
||||
thead
|
||||
tr
|
||||
th Name
|
||||
th Description
|
||||
th Actions
|
||||
tbody
|
||||
- @passive_skills.each do |passive_skill|
|
||||
tr
|
||||
td= passive_skill.name
|
||||
td= passive_skill.description
|
||||
td
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_passive_skill_path(passive_skill)
|
||||
= link_to glyph('trash', classes: 'control-icon'), passive_skill_path(passive_skill), method: :delete
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Passive Skill', new_passive_skill_path, class: 'btn btn-primary'
|
1
app/views/passive_skills/new.html.slim
Normal file
1
app/views/passive_skills/new.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
6
app/views/rarities/_form.html.slim
Normal file
6
app/views/rarities/_form.html.slim
Normal file
|
@ -0,0 +1,6 @@
|
|||
= simple_form_for @rarity do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
= f.input :description
|
||||
.form-actions
|
||||
= f.button :button
|
1
app/views/rarities/edit.html.slim
Normal file
1
app/views/rarities/edit.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
25
app/views/rarities/index.html.slim
Normal file
25
app/views/rarities/index.html.slim
Normal file
|
@ -0,0 +1,25 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Rarity', new_rarity_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
table.table.table-striped.table-hover
|
||||
thead
|
||||
tr
|
||||
th Name
|
||||
th Description
|
||||
th Actions
|
||||
tbody
|
||||
- @rarities.each do |rarity|
|
||||
tr
|
||||
td= rarity.name
|
||||
td= rarity.description
|
||||
td
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_rarity_path(rarity)
|
||||
= link_to glyph('trash', classes: 'control-icon'), rarity_path(rarity), method: :delete
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Rarity', new_rarity_path, class: 'btn btn-primary'
|
1
app/views/rarities/new.html.slim
Normal file
1
app/views/rarities/new.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
6
app/views/super_attacks/_form.html.slim
Normal file
6
app/views/super_attacks/_form.html.slim
Normal file
|
@ -0,0 +1,6 @@
|
|||
= simple_form_for @super_attack do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
= f.input :description
|
||||
.form-actions
|
||||
= f.button :button
|
1
app/views/super_attacks/edit.html.slim
Normal file
1
app/views/super_attacks/edit.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
25
app/views/super_attacks/index.html.slim
Normal file
25
app/views/super_attacks/index.html.slim
Normal file
|
@ -0,0 +1,25 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Super Attack', new_super_attack_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
table.table.table-striped.table-hover
|
||||
thead
|
||||
tr
|
||||
th Name
|
||||
th Description
|
||||
th Actions
|
||||
tbody
|
||||
- @super_attacks.each do |super_attack|
|
||||
tr
|
||||
td= super_attack.name
|
||||
td= super_attack.description
|
||||
td
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_super_attack_path(super_attack)
|
||||
= link_to glyph('trash', classes: 'control-icon'), super_attack_path(super_attack), method: :delete
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Super Attack', new_super_attack_path, class: 'btn btn-primary'
|
1
app/views/super_attacks/new.html.slim
Normal file
1
app/views/super_attacks/new.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
6
app/views/types/_form.html.slim
Normal file
6
app/views/types/_form.html.slim
Normal file
|
@ -0,0 +1,6 @@
|
|||
= simple_form_for @type do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
= f.input :description
|
||||
.form-actions
|
||||
= f.button :button
|
1
app/views/types/edit.html.slim
Normal file
1
app/views/types/edit.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
25
app/views/types/index.html.slim
Normal file
25
app/views/types/index.html.slim
Normal file
|
@ -0,0 +1,25 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Type', new_type_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
table.table.table-striped.table-hover
|
||||
thead
|
||||
tr
|
||||
th Name
|
||||
th Description
|
||||
th Actions
|
||||
tbody
|
||||
- @types.each do |type|
|
||||
tr
|
||||
td= type.name
|
||||
td= type.description
|
||||
td
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_type_path(type)
|
||||
= link_to glyph('trash', classes: 'control-icon'), type_path(type), method: :delete
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Type', new_type_path, class: 'btn btn-primary'
|
1
app/views/types/new.html.slim
Normal file
1
app/views/types/new.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
== render 'form'
|
|
@ -3,7 +3,15 @@ Rails.application.routes.draw do
|
|||
get 'auth/failure', to: 'sessions#failure'
|
||||
delete 'logout', to: 'sessions#destroy', as: 'logout'
|
||||
|
||||
resources :awaken_types
|
||||
resources :cards
|
||||
resources :characters
|
||||
resources :leader_skills
|
||||
resources :links
|
||||
resources :passive_skills
|
||||
resources :rarities
|
||||
resources :super_attacks
|
||||
resources :types
|
||||
resources :welcome, only: [:index]
|
||||
|
||||
root to: 'welcome#index'
|
||||
|
|
9
db/migrate/20151006175227_create_characters.rb
Normal file
9
db/migrate/20151006175227_create_characters.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class CreateCharacters < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :characters do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
10
db/migrate/20151006175240_create_rarities.rb
Normal file
10
db/migrate/20151006175240_create_rarities.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class CreateRarities < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :rarities do |t|
|
||||
t.string :name
|
||||
t.string :description
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
10
db/migrate/20151006175252_create_types.rb
Normal file
10
db/migrate/20151006175252_create_types.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class CreateTypes < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :types do |t|
|
||||
t.string :name
|
||||
t.string :description
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
10
db/migrate/20151006175332_create_medals.rb
Normal file
10
db/migrate/20151006175332_create_medals.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class CreateMedals < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :medals do |t|
|
||||
t.string :name
|
||||
t.text :location
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
10
db/migrate/20151006175353_create_leader_skills.rb
Normal file
10
db/migrate/20151006175353_create_leader_skills.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class CreateLeaderSkills < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :leader_skills do |t|
|
||||
t.string :name
|
||||
t.string :description
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
10
db/migrate/20151006175429_create_passive_skills.rb
Normal file
10
db/migrate/20151006175429_create_passive_skills.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class CreatePassiveSkills < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :passive_skills do |t|
|
||||
t.string :name
|
||||
t.string :description
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
10
db/migrate/20151006175442_create_super_attacks.rb
Normal file
10
db/migrate/20151006175442_create_super_attacks.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class CreateSuperAttacks < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :super_attacks do |t|
|
||||
t.string :name
|
||||
t.string :description
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
17
db/migrate/20151006180454_create_cards.rb
Normal file
17
db/migrate/20151006180454_create_cards.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
class CreateCards < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :cards do |t|
|
||||
t.references :character, index: true, foreign_key: true
|
||||
t.references :rarity, index: true, foreign_key: true
|
||||
t.references :type, index: true, foreign_key: true
|
||||
t.references :leader_skill, index: true, foreign_key: true
|
||||
t.references :passive_skill, index: true, foreign_key: true
|
||||
t.references :super_attack, index: true, foreign_key: true
|
||||
t.integer :dokkan_id, index: true, foreign_key: true
|
||||
t.string :suffix
|
||||
t.string :gameid
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
10
db/migrate/20151006182022_create_cards_links.rb
Normal file
10
db/migrate/20151006182022_create_cards_links.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class CreateCardsLinks < ActiveRecord::Migration
|
||||
def change
|
||||
create_join_table :cards, :links do |t|
|
||||
t.references :card, index: true, foreign_key: true
|
||||
t.references :link, index: true, foreign_key: true
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
6
db/migrate/20151007130958_fix_card_fields.rb
Normal file
6
db/migrate/20151007130958_fix_card_fields.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class FixCardFields < ActiveRecord::Migration
|
||||
def change
|
||||
change_column :cards, :gameid, :string, default: '0000000'
|
||||
rename_column :cards, :suffix, :prefix
|
||||
end
|
||||
end
|
11
db/migrate/20151007164606_create_awaken_types.rb
Normal file
11
db/migrate/20151007164606_create_awaken_types.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
class CreateAwakenTypes < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :awaken_types do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_reference :cards, :awaken_type, index: true
|
||||
end
|
||||
end
|
90
db/schema.rb
90
db/schema.rb
|
@ -11,7 +11,60 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20151001151519) do
|
||||
ActiveRecord::Schema.define(version: 20151007164606) do
|
||||
|
||||
create_table "awaken_types", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "cards", force: :cascade do |t|
|
||||
t.integer "character_id"
|
||||
t.integer "rarity_id"
|
||||
t.integer "type_id"
|
||||
t.integer "leader_skill_id"
|
||||
t.integer "passive_skill_id"
|
||||
t.integer "super_attack_id"
|
||||
t.integer "dokkan_id"
|
||||
t.string "prefix"
|
||||
t.string "gameid", default: "0000000"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "awaken_type_id"
|
||||
end
|
||||
|
||||
add_index "cards", ["awaken_type_id"], name: "index_cards_on_awaken_type_id"
|
||||
add_index "cards", ["character_id"], name: "index_cards_on_character_id"
|
||||
add_index "cards", ["dokkan_id"], name: "index_cards_on_dokkan_id"
|
||||
add_index "cards", ["leader_skill_id"], name: "index_cards_on_leader_skill_id"
|
||||
add_index "cards", ["passive_skill_id"], name: "index_cards_on_passive_skill_id"
|
||||
add_index "cards", ["rarity_id"], name: "index_cards_on_rarity_id"
|
||||
add_index "cards", ["super_attack_id"], name: "index_cards_on_super_attack_id"
|
||||
add_index "cards", ["type_id"], name: "index_cards_on_type_id"
|
||||
|
||||
create_table "cards_links", id: false, force: :cascade do |t|
|
||||
t.integer "card_id"
|
||||
t.integer "link_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "cards_links", ["card_id"], name: "index_cards_links_on_card_id"
|
||||
add_index "cards_links", ["link_id"], name: "index_cards_links_on_link_id"
|
||||
|
||||
create_table "characters", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "leader_skills", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "description"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "links", force: :cascade do |t|
|
||||
t.string "name"
|
||||
|
@ -20,6 +73,41 @@ ActiveRecord::Schema.define(version: 20151001151519) do
|
|||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "medals", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.text "location"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "passive_skills", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "description"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "rarities", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "description"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "super_attacks", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "description"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "types", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "description"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "provider"
|
||||
t.string "uid"
|
||||
|
|
39
db/seeds.rb
39
db/seeds.rb
|
@ -1,7 +1,32 @@
|
|||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
||||
# Mayor.create(name: 'Emanuel', city: cities.first)
|
||||
types = [
|
||||
['Physical', 'PHY', 'yellow'],
|
||||
['Intellect', 'INT', 'purple'],
|
||||
['Technique', 'TEQ', 'green'],
|
||||
['Agility', 'AGL', 'blue'],
|
||||
['Strength', 'STR', 'red'],
|
||||
]
|
||||
|
||||
rarities = [
|
||||
['Normal', 'N'],
|
||||
['Rare', 'R'],
|
||||
['Super Rare', 'SR'],
|
||||
['Super Super Rare', 'SSR'],
|
||||
['Ultra Rare', 'UR'],
|
||||
]
|
||||
|
||||
awaken_types = [
|
||||
'Super',
|
||||
'Extreme',
|
||||
]
|
||||
|
||||
types.each do |description, name|
|
||||
Type.create(name: name, description: description)
|
||||
end
|
||||
|
||||
rarities.each do |description, name|
|
||||
Rarity.create(name: name, description: description)
|
||||
end
|
||||
|
||||
awaken_types.each do |name|
|
||||
AwakenType.create(name: name)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue