I have a current_user via resthul_auth thast HABTM projects. In my
projects_controller's index action, I have
@page_title = "All Projects"
@projects = current_account.projects
@projects = current_user.projects
@project_companies = @projects.group_by(&:primary_company)
The problem is, the HASH can't be sorted - in my view, I group the
projects by their primary company. The group_by gives me a hash with a
primary company object as the key. I can either use the
:primary_company_id, which just gives me the integer, or the
:primary_company, which through some magic gives me a whole object as a
hash key. Is there any inbetween? something like:
@project_companies = @projects.group_by(&:primary_company.name) (which
that will only give me the name string from that object as a hash key?
Otherwise the view isn't in alphabetical order, or in any order really.
I'm kind of stuck!!!!