Created
May 29, 2012 00:45
-
-
Save bobbypage/2821923 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
#user.rb | |
class User < ActiveRecord::Base | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable | |
# Setup accessible (or protected) attributes for your model | |
attr_accessible :email, :password, :password_confirmation, :remember_me | |
# attr_accessible :title, :body | |
has_many :apps, :campaigns | |
end | |
#app.rb | |
class App < ActiveRecord::Base | |
attr_accessible :name, :promo_code_list, :user_id | |
has_many :campaigns | |
has_many :promo_codes | |
belongs_to :user | |
end | |
#campaign.rb | |
class Campaign < ActiveRecord::Base | |
belongs_to :app | |
attr_accessible :name, :app_id, :promo_code_count | |
end | |
#campaigns_controller.rb | |
class CampaignsController < ApplicationController | |
# GET /campaigns | |
# GET /campaigns.json | |
before_filter :authenticate_user! | |
def index | |
@campaigns = Campaign.all | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment