in a app, I have the follow codes:
class UserProfile < ActiveRecord::Base
belongs_to :user
has_and_belongs_to_many :knowledge_areas, join_table: 'user_profiles_knowledge_areas', order: 'identifier'
class KnowledgeArea < ActiveRecord::Base
attr_accessible :identifier, :label_key
attr_readonly :identifier, :label_key
In my database, I have a table call name: user_profiles_knowledge_areas
How can I count and acess the records in this table?
I tried some options, like:
<%= @teste = UserProfile.knowledge_areas.find(:all) %>
<%= @a = UserProfile.user_profiles_knowledge_areas %>
But anyone works, please, someone Can help me?
Sorry for my english, I'm learning yet