Created
March 6, 2013 21:56
-
-
Save ameuret/5103456 to your computer and use it in GitHub Desktop.
As a newcomer to Sequel's ORM, it took me quite a while to figure out why this code would throw `method mimetype= doesn't exist (Sequel::Error)` on the `create` call.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sequel' | |
DB = Sequel.sqlite | |
DB.create_table :mimetype do | |
primary_key :id | |
column :mimetype, :text, :unique=>true | |
column :extension, :text | |
end | |
class Mimetype < Sequel::Model; end | |
Mimetype.create(:mimetype => 'text/bullshit', :extension => 'bs') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Long story short, this is because I did not pluralize the table name. Not the most helpful error message in this case.