On Dec 31, 1:15 am, "Andrei (L.A.)" <[email protected]> wrote:
> Sequel newbie here...
>
> Is there anything I am missing? Do I need to import plugins separately
> from 'sequel'? How to do that?
>
> require 'rubygems'
> require 'sequel'
>
> DB = Sequel.sqlite
>
> DB.create_table(:posts) do
>   primary_key :id
>   String :name
>   DateTime :updated_at
>   DateTime :created_at
>   TrueClass :published
> end
>
> class Posts < Sequel::Model(:posts)

FYI, Model names should be singular (Post, not Posts).

>   plugin :timestamps
> end
>
> Posts.insert(:name => "John Smith")

Posts.insert here is Dataset#insert, which doesn't call the model
create hooks.  You should use Post.create.  Try that and it should fix
the issue.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to