Skip to content

Instantly share code, notes, and snippets.

@sapient
Forked from Znow/create_job_users.rb
Created November 3, 2011 09:36
Show Gist options
  • Save sapient/1336139 to your computer and use it in GitHub Desktop.
Save sapient/1336139 to your computer and use it in GitHub Desktop.
class Application < ActiveRecord::Base
belongs_to :user
belongs_to :job
# This model can also have validations to ensure applications are valid, whatever you want.
# Extra fields can also be added to this file, so it might get another field :rejected for example.
end
class Job < ActiveRecord::Base
has_many :applications
has_many :users, :through => :applications
end
# encoding: UTF-8
class User < ActiveRecord::Base
has_many :applications
has_many :jobs, :through => :applications
devise :database_authenticatable, :registerable, :recoverable, :trackable, :validatable
attr_accessible :email, :password,
:password_confirmation,
:remember_me,
:fname,
:lname,
:bday,
:address,
:areacode,
:city,
:education,
:info,
:looking_for,
:tele,
:cv,
:cv_file_name,
:cv_content_type,
:cv_file_size,
:cv_updated_at
has_attached_file :cv
validates_attachment_size :cv, :less_than => 2.megabytes
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment