Last Updated: February 25, 2016
·
584
· arnaudm

When Sequel seems well sick

As a newcomer to Sequel or ActiveRecord ORMs you may not immediately figure out why this code spits

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')

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