Skip to content

Instantly share code, notes, and snippets.

@mmower
Created July 29, 2008 15:23
Show Gist options
  • Save mmower/3104 to your computer and use it in GitHub Desktop.
Save mmower/3104 to your computer and use it in GitHub Desktop.
## Error (only appears in rspec)
Mysql::Error: Unknown column 'refname' in 'where clause': SELECT * FROM `device_profiles` WHERE (refname = 'pc') LIMIT 1
## Schema
t.string "refname", :limit => 16
## SQL
mysql> SELECT * FROM `device_profiles` WHERE (refname = 'pc') LIMIT 1;
+----+--------------+---------+------------------+-------------------+---------------------+---------------------+------------+---------------+-----------------+----------+---------+
| id | manufacturer | model | resolution_width | resolution_height | created_at | updated_at | user_agent | playback_type | playback_format | platform | refname |
+----+--------------+---------+------------------+-------------------+---------------------+---------------------+------------+---------------+-----------------+----------+---------+
| 37 | reeplay | Generic | 512 | 384 | 2008-07-29 15:16:12 | 2008-07-29 15:16:12 | NULL | streaming | flvplayer | default | pc |
+----+--------------+---------+------------------+-------------------+---------------------+---------------------+------------+---------------+-----------------+----------+---------+
1 row in set (0.00 sec)
## "Failing" Ruby code
def self.reference( ref )
find( :first, :conditions => ['refname = ?', ref] )
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment