Jade Z. wrote in post #1044699:
Im currently new in rails and using v 2.3.11
I would like to ask if how can I query entries without including their
class CreatesStudent < ActiveRecord::Migration
create_table :students do |t|
Also worth noting that if you did have duplicates in the table you show
here then you’d be saying that you have two people with exactly the same
name. Possible of course, but without additional detail you would have a
tough time knowing which one was which.
Doing a uniq query on this table would probably be a bad idea. You would
have one result that represents two, or more, different people and you
would have no way to know which one was which.
By default Rails will automatically provide a unique index in the form
of an auto-incrementing integer id column. It uses that as the primary
key for the table. A normal query will include that column so there is
generally no need for distinct queries (i.e. SELECT DISTINCT).
On the other hand, if you actually have duplicate records that represent
the same person then you’ve got a bad design problem that you should fix
General rule of thumb is that distinct queries should be fairly rare in
ORM based frameworks. The mapping could get easily confused by not
knowing which object represents which row in the table.