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.
Written by Arnaud Meuret
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#