Which Rails query are you using for getting the output?

On Sat, Jul 19, 2014 at 6:00 PM, Mano Svajone <[email protected]> wrote:

> Restaurant Load (1.5ms)  SELECT * FROM "restaurants" INNER JOIN
> "restaurant_branches" ON "restaurant_branches"."restaurant_id" =
> "restaurants"."restaurant_id"
>
> +----------+---------+---------+---------+----------+---------+----------+---------+---------+---------+---------+---------+---------+---------+---------+-------+
> | resta... | res_... | res_... | crea... | updat... | user_id | resta... |
> addr...
> | addr... | addr... | addr... | addr... | addr... | numb... | numb... |
> email |
>
> +----------+---------+---------+---------+----------+---------+----------+---------+---------+---------+---------+---------+---------+---------+---------+-------+
> | 27       | DOGG... | WE S... | 2014... | 2014-... | 4       | 28       |
> 405 ...
> |         | CHICAGO | IL      | 60666   | USA     |         |         |
>     |
> | 27       | DOGG... | WE S... | 2014... | 2014-... | 4       | 29       |
> 111 ...
> |         | CHICAGO | IL      | 60661   | USA     |         |         |
>     |
>
> +----------+---------+---------+---------+----------+---------+----------+---------+---------+---------+---------+---------+---------+---------+---------+-------+
>
> As you can see, I have two records for record 27. This is from a joined
> table between restaurants and restaurant_branches. How would I approach
> this in a view so that when I select a record on my index.html.erb file
> when it gets routed to the show.html.erb file it'll only take one row of
> that record and only show me one branch instead of 2?
>
> Thank you for any help.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/91a09235a01d850bda588d149bb1640e%40ruby-forum.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CABs06hPAnN4s8L-2oZ_6rw4zaUod-p68EOywO5AMSJZjDNJTOQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to