← Back to Upcase

Advanced ActiveRecord Querying - belongs_to Associations


(Upcase ) #1

This topic is for the Querying belongs_to Associations exercise in the Advanced ActiveRecord Querying trail. Post any questions, comments, or pointers you have to share with other Upcase subscribers.


(Robert Lee-Cann) #4

NB: These exercise require the PostgreSQL database to be installed.

If you’re using OSX, the easiest way is to install Postgres.app. Afterwards, you should follow these instructions ensure that bin/setup can find the command-line tools in order to create the required database(s).


(jaeming) #5

I felt like the first video did not sufficiently prepare me for the last spec of this exercise. Most of that seems to be covered in the video after the exercize, almost making it feel like some of this is out of order. The spec I refer to is alphabetically_by_region_and_location and the video that better seems to prepare for it is the has_many one: https://thoughtbot.com/upcase/videos/advanced-querying-has-many


(Leigh Scherrer) #6

Very helpful to know–thank you!


(Maxime Orefice) #7

Yes I agree It’s a little bit tricky without having seen the has_many episode


(John Munyi) #8

Hi what about when using Ubuntu 14.04 , I have PostgreSQL set up already, so after cloning when run bin/setup I get the below error, do i need to set up adatabase.yml in my case , it seem createdb is failing password authentication, see error

fe_sendauth: no password supplied (PG::ConnectionBad)


(Hashim Colombowala) #9

You might need to add your PostgreSQL username and password to in spec_helper.rb


(John Munyi) #10

Thanks solved !!


(Nick Schwad) #13

I have to say, the description on the second spec could do with further clarity, either in a comment or in rewriting line 23.

Is the object that we first order people by their location’s regions name alphabetically, then only in the case of an alphabetical ‘tie’ (say two people are region2) we alphabetize them according to their location’s name, then only in the case of a double-tie (say multiple people with location3 and region2) we alphabetize them on their personal name?