Adds sponsorship levels model

This commit is contained in:
Gopesh Tulsyan 2014-06-05 11:56:04 +05:30
parent 069cc0eb4c
commit 8bce579283
6 changed files with 69 additions and 9 deletions

View file

@ -31,6 +31,7 @@ class Conference < ActiveRecord::Base
has_many :vdays, :dependent => :destroy
has_many :vpositions, :dependent => :destroy
has_many :vchoices, :dependent => :destroy
has_many :sponsorship_levels, dependent: :destroy
belongs_to :venue

View file

@ -0,0 +1,5 @@
class SponsorshipLevel < ActiveRecord::Base
attr_accessible :title, :donation_amount
validates_presence_of :title
belongs_to :conference
end

View 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

View file

@ -50,15 +50,15 @@ ActiveRecord::Schema.define(version: 20140605125153) do
add_index "comments", ["user_id"], name: "index_comments_on_user_id"
create_table "conferences", force: true do |t|
t.string "guid", null: false
t.string "title", null: false
t.string "short_title", null: false
t.string "guid", null: false
t.string "title", null: false
t.string "short_title", null: false
t.string "social_tag"
t.string "contact_email", null: false
t.string "timezone", null: false
t.string "contact_email", null: false
t.string "timezone", null: false
t.string "html_export_path"
t.date "start_date", null: false
t.date "end_date", null: false
t.date "start_date", null: false
t.date "end_date", null: false
t.integer "venue_id"
t.datetime "created_at"
t.datetime "updated_at"
@ -288,6 +288,27 @@ ActiveRecord::Schema.define(version: 20140605125153) do
t.date "date"
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|
t.integer "conference_id"
t.string "title", null: false
@ -308,9 +329,9 @@ ActiveRecord::Schema.define(version: 20140605125153) do
end
create_table "tracks", force: true do |t|
t.string "guid", null: false
t.string "guid", null: false
t.integer "conference_id"
t.string "name", null: false
t.string "name", null: false
t.text "description"
t.string "color"
t.datetime "created_at"

View 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

View 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