Skip to content

Instantly share code, notes, and snippets.

@ameuret
Created March 6, 2013 21:56
Show Gist options
  • Save ameuret/5103456 to your computer and use it in GitHub Desktop.
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.
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')
@ameuret
Copy link
Author

ameuret commented Mar 6, 2013

Long story short, this is because I did not pluralize the table name. Not the most helpful error message in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment