Hi Sequel people. I've read the documents from more than one source and
it's still not working.
Code:
DBL.create_table? :salads do # works
primary_key :id
String :name, size: 200
Integer :temp
String :review
DateTime :cdate
DateTime :mdate
String :status
end
class Salad < Sequel::Model
attr_accessor :id, :name, :temp, :review, :cdate, :mdate, :status
def initialize(args = nil)
@name = nil
@temp = 'cold'
@review = 'nry'
@cdate = Time.now
@status = 'new'
end
set_primary_key [:id]
# self.strict_param_setting = false
end
a = Salad.new
puts a.inspect # empty
a.name = 'Cobb'
puts a.inspect # empty
a.temp = '4°C'
puts a.inspect # empty
a.status = 'On Hold'
puts a.inspect # empty
puts "values: #{ a.values }" # empty
puts
puts a.name # works
puts a.temp # works
puts a.review # works
puts a.cdate # works
puts a.status # works
Table created, class definition works. Instantiation works. Changing
properties works.
The issue is that the Sequel methods aren't working.
a.inspect brings up empty objects as seen below.
a.values also is empty.
Results:
#<Salad @values=nil>
#<Salad @values=nil>
#<Salad @values=nil>
#<Salad @values=nil>
values:
Cobb
4°C
nry
2020-01-23 02:30:56 -0500
On Hold
I'm sure it's something obvious, but what am I missing?
Cheers
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/sequel-talk/2a0711dc-6bc8-4f0c-ab75-a8c001501e6b%40googlegroups.com.