Skip to content

Commit

Permalink
Create beta_signups for users
Browse files Browse the repository at this point in the history
  • Loading branch information
courte committed Mar 4, 2015
1 parent f3bd04c commit 02b2b71
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/models/beta_signup.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class BetaSignup < ActiveRecord::Base
belongs_to :user

validates :user_id, uniqueness: true
end
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class User < ActiveRecord::Base

has_many :services
has_one :profile, class_name: 'UserProfile'
has_one :beta_signup
delegate :gravatar_email, :headline, :is_coder, :name, :represents_org, :represents_team, :cause_list, :technology_list, :email_news, :email_training, to: :profile

validates_presence_of :password, on: :create # will only run on account creation
Expand Down
10 changes: 10 additions & 0 deletions db/migrate/20150227190642_create_beta_signups.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateBetaSignups < ActiveRecord::Migration
def change
create_table :beta_signups do |t|
t.references :user
t.timestamps
end

add_index :beta_signups, :user_id
end
end
10 changes: 9 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20150213195324) do
ActiveRecord::Schema.define(:version => 20150227190642) do

create_table "active_admin_comments", :force => true do |t|
t.string "namespace"
Expand All @@ -27,6 +27,14 @@
add_index "active_admin_comments", ["namespace"], :name => "index_active_admin_comments_on_namespace"
add_index "active_admin_comments", ["resource_type", "resource_id"], :name => "index_active_admin_comments_on_resource_type_and_resource_id"

create_table "beta_signups", :force => true do |t|
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end

add_index "beta_signups", ["user_id"], :name => "index_beta_signups_on_user_id"

create_table "event_registrations", :force => true do |t|
t.integer "event_id", :null => false
t.integer "user_id", :null => false
Expand Down

0 comments on commit 02b2b71

Please sign in to comment.