Little further investigate maybe it's because of the suffix "id" it 
appears? If I change to just "object_i" it works fine.. 

On Saturday, October 19, 2013 11:39:27 PM UTC+13, Robert Payne wrote:
>
> So I'm having this extremely weird issue with an integer column not being 
> available via instance method in a before/after save hook. See below test 
> code:
>
> require 'sequel'
>
> DB = Sequel.sqlite(':memory:')
>
> DB.create_table(:notifications_jobs) do
>   primary_key :id
>   String :object_kind, size: 60, null: false
>   Integer :object_id, null: false
> end
>
> class NotificationJob < Sequel::Model(:notifications_jobs)
>
>   protected
>
>   def before_save
>     puts "#{self.object_kind}, #{self[:object_kind]}"
>     puts "#{self.object_id}, #{self[:object_id]}"
>   end
>
> end
>
> NotificationJob.create(object_kind: 'hello', object_id: 5)
>
> If you run this small example object_kind is available via the instance 
> method but the integer returns what I'm assuming is the maximum integer 
> value in Ruby likely due to it being undefined?
>
> Is this intended functionality / should I be doing this differently?
>
> Cheers,
> Robert
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to