class User < ActiveRecord::Base
has_many :correlations
has_many :roles, :through => :correlations
has_many :skills, :through => :correlations
attr_accessible :email, :password, :password_confirmation, :remember_me,
:role_ids, :skill_ids, :username, :first_name, :last_name, :address, :city,
:state , :country, :phone_number, :photo,:fullname, :shortbio, :weburl
def role?(role)
return !!self.roles.find_by_name(role.to_s.camelize)
end
def skill?(skill)
return !!self.skills.find_by_name(skill.to_s.camelize)
end
end
class Correlation < ActiveRecord::Base
belongs_to :role
belongs_to :skill
belongs_to :user
end
class Skill < ActiveRecord::Base
has_many :correlations
has_many :roles, :through => :correlations
has_many :users, :through => :correlations
end
class Role < ActiveRecord::Base
has_many :correlations
has_many :skills, :through => :correlations
has_many :users, :through => :correlations
end
module ArticlesHelper
def skill_list
skills_ids = current_user.skill_ids
skills_ids.delete_if {|x| x == nil}
skills = Skill.find(skills_ids)
return skills
end
end
if working fine but on heroku console
@user.skill_ids
NoMethodError: undefined method `skill_ids' for
#<ActiveRecord::Relation:0x00000005515b58>
@user.role_ids
NoMethodError: undefined method `skill_ids' for
#<ActiveRecord::Relation:0x00000005515b58>
Any idea?
Pleaase help
ccdd
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/cT_VsW2C9RoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.