Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Job < ActiveRecord::Base
- validates :title, presence: true
- validates :company, presence: true
- validates :url, presence: true
- has_many :position_type_joins
- has_many :position_types, through: :position_type_joins
- accepts_nested_attributes_for :position_types, :allow_destroy => true
- end
- class PositionType < ApplicationRecord
- has_many :position_type_joins
- has_many :jobs, through: :position_type_joins
- end
- class PositionTypeJoin < ApplicationRecord
- belongs_to :job
- belongs_to :position_type
- end
- +-------------------+----------------------+
- | Job title | Position Type |
- +-------------------+----------------------+
- | Painter | Contract, Part time |
- | Library Assistant | Part time, Volunteer |
- +-------------------+----------------------+
- index do
- column :code
- column 'Sales Agent' do |client|
- client.sales_agent.agent_name if !client.sales_agent.nil?
- end
- end
- index do
- column 'Position type' do |job|
- job.position_type.name if !job.position_type.name?
- end
- end
- undefined method `position_type'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement