Adds sponsorship levels model
This commit is contained in:
parent
069cc0eb4c
commit
8bce579283
6 changed files with 69 additions and 9 deletions
|
|
@ -31,6 +31,7 @@ class Conference < ActiveRecord::Base
|
||||||
has_many :vdays, :dependent => :destroy
|
has_many :vdays, :dependent => :destroy
|
||||||
has_many :vpositions, :dependent => :destroy
|
has_many :vpositions, :dependent => :destroy
|
||||||
has_many :vchoices, :dependent => :destroy
|
has_many :vchoices, :dependent => :destroy
|
||||||
|
has_many :sponsorship_levels, dependent: :destroy
|
||||||
|
|
||||||
belongs_to :venue
|
belongs_to :venue
|
||||||
|
|
||||||
|
|
|
||||||
5
app/models/sponsorship_level.rb
Normal file
5
app/models/sponsorship_level.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
class SponsorshipLevel < ActiveRecord::Base
|
||||||
|
attr_accessible :title, :donation_amount
|
||||||
|
validates_presence_of :title
|
||||||
|
belongs_to :conference
|
||||||
|
end
|
||||||
10
db/migrate/20140605055802_create_sponsorship_levels.rb
Normal file
10
db/migrate/20140605055802_create_sponsorship_levels.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
class CreateSponsorshipLevels < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :sponsorship_levels do |t|
|
||||||
|
t.string :title
|
||||||
|
t.string :donation_amount
|
||||||
|
t.belongs_to :conference
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
39
db/schema.rb
39
db/schema.rb
|
|
@ -50,15 +50,15 @@ ActiveRecord::Schema.define(version: 20140605125153) do
|
||||||
add_index "comments", ["user_id"], name: "index_comments_on_user_id"
|
add_index "comments", ["user_id"], name: "index_comments_on_user_id"
|
||||||
|
|
||||||
create_table "conferences", force: true do |t|
|
create_table "conferences", force: true do |t|
|
||||||
t.string "guid", null: false
|
t.string "guid", null: false
|
||||||
t.string "title", null: false
|
t.string "title", null: false
|
||||||
t.string "short_title", null: false
|
t.string "short_title", null: false
|
||||||
t.string "social_tag"
|
t.string "social_tag"
|
||||||
t.string "contact_email", null: false
|
t.string "contact_email", null: false
|
||||||
t.string "timezone", null: false
|
t.string "timezone", null: false
|
||||||
t.string "html_export_path"
|
t.string "html_export_path"
|
||||||
t.date "start_date", null: false
|
t.date "start_date", null: false
|
||||||
t.date "end_date", null: false
|
t.date "end_date", null: false
|
||||||
t.integer "venue_id"
|
t.integer "venue_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
|
|
@ -288,6 +288,27 @@ ActiveRecord::Schema.define(version: 20140605125153) do
|
||||||
t.date "date"
|
t.date "date"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "sponsors", force: true do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.text "description"
|
||||||
|
t.string "website_url"
|
||||||
|
t.string "logo_file_name"
|
||||||
|
t.string "logo_content_type"
|
||||||
|
t.integer "logo_file_size"
|
||||||
|
t.datetime "logo_updated_at"
|
||||||
|
t.integer "sponsorship_level_id"
|
||||||
|
t.integer "conference_id"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "sponsorship_levels", force: true do |t|
|
||||||
|
t.string "title"
|
||||||
|
t.integer "conference_id"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "supporter_levels", force: true do |t|
|
create_table "supporter_levels", force: true do |t|
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
t.string "title", null: false
|
t.string "title", null: false
|
||||||
|
|
@ -308,9 +329,9 @@ ActiveRecord::Schema.define(version: 20140605125153) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "tracks", force: true do |t|
|
create_table "tracks", force: true do |t|
|
||||||
t.string "guid", null: false
|
t.string "guid", null: false
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.string "color"
|
t.string "color"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
|
|
|
||||||
9
spec/factories/sponsorship_levels.rb
Normal file
9
spec/factories/sponsorship_levels.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||||
|
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :sponsorship_level do
|
||||||
|
title 'Platin'
|
||||||
|
donation_amount '$100,000'
|
||||||
|
conference
|
||||||
|
end
|
||||||
|
end
|
||||||
14
spec/models/sponsorship_level_spec.rb
Normal file
14
spec/models/sponsorship_level_spec.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe SponsorshipLevel do
|
||||||
|
describe 'validations' do
|
||||||
|
|
||||||
|
it 'has a valid factory' do
|
||||||
|
expect(build(:sponsorship_level)).to be_valid
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'is not valid without a title' do
|
||||||
|
should validate_presence_of(:title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue