I know I must call save after making change. But once I call save, I am 
getting

Sequel::Error: can't express 
#<Java::OrgPostgresqlUtil::PGobject:0x6c26cb7b> as a SQL literal
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/sequel-4.14.0/lib/sequel/dataset/sql.rb:1230:in
 
`literal_other_append'
 from /Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/
sequel-4.14.0/lib/sequel/dataset/sql.rb:107:in `literal_append'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/sequel-4.14.0/lib/sequel/dataset/sql.rb:1543:in
 
`update_set_sql'
 from org/jruby/RubyHash.java:1341:in `each'
 from /Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/
sequel-4.14.0/lib/sequel/dataset/sql.rb:1535:in `update_set_sql'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/sequel-4.14.0/lib/sequel/dataset/sql.rb:228:in
 
`_update_sql'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/sequel-4.14.0/lib/sequel/dataset/sql.rb:174:in
 
`update_sql'
 from /Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/
sequel-4.14.0/lib/sequel/dataset/actions.rb:769:in `update'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/sequel-4.14.0/lib/sequel/model/base.rb:1928:in
 
`_update_without_checking'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/sequel-4.14.0/lib/sequel/model/base.rb:1915:in
 
`_update'
 from /Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/
sequel-4.14.0/lib/sequel/model/base.rb:1909:in `_update_columns'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/sequel-4.14.0/lib/sequel/model/base.rb:1857:in
 
`_save'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/sequel-4.14.0/lib/sequel/model/base.rb:1111:in
 
`around_update'
 from /Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/
sequel-4.14.0/lib/sequel/model/base.rb:1841:in `_save'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/sequel-4.14.0/lib/sequel/model/base.rb:1111:in
 
`around_save'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/sequel-4.14.0/lib/sequel/model/base.rb:1824:in
 
`_save'
... 21 levels...
 from /Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/
rake-10.3.2/lib/rake/task.rb:179:in `invoke_with_call_chain'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/1.9/monitor.rb:211:in `
mon_synchronize'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/task.rb:172:in
 
`invoke_with_call_chain'
 from /Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/
rake-10.3.2/lib/rake/task.rb:165:in `invoke'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:150:in
 
`invoke_task'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:106:in
 
`top_level'
 from org/jruby/RubyArray.java:1613:in `each'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:106:in
 
`top_level'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:115:in
 
`run_with_threads'
 from /Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/
rake-10.3.2/lib/rake/application.rb:100:in `top_level'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:78:in
 
`run'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:176:in
 
`standard_exception_handling'
 from /Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/
rake-10.3.2/lib/rake/application.rb:75:in `run'
 from 
/Users/Petr/.rbenv/versions/jruby-1.7.15/lib/ruby/gems/shared/gems/rake-10.3.2/bin/rake:33:in
 
`(root)'
 from org/jruby/RubyKernel.java:1081:in `load'
   t.save



On Monday, September 22, 2014 7:53:29 PM UTC+2, Jeremy Evans wrote:
>
> On Monday, September 22, 2014 9:09:24 AM UTC-7, Petr Kaleta wrote:
>>
>> Hey Jeremy,
>> sorry for late response. I am having exactly same issues with json 
>> extension. Simply it seems, that you can't modify 
>> `Sequel::Postgres::JSONHash` and `Sequel::Postgres::HStore` directly like 
>> `model.json_attr[:key] = true`, or `model.hstore_attr[:key] = true`
>>
>> What works for me is `model.json_attr = 
>> model.json_attr.to_hash.merge(key: true)` so i must reassign whole pure 
>> hash. Everything else works as expected. I have issues just with this 
>> direct manipulation.
>>
>
> You can directly manipulate the hash.  However, Sequel won't automatically 
> detect changes, so #save_changes/#update won't save them (though #save 
> will).  You can either switch to using #save, or you can use 
> modified!(:json_attr) to explicitly mark the column as modified, in which 
> case #save_changes/#update will work.  You could also use the 
> modification_detection plugin.
>
> Thanks,
> Jeremy 
>

-- 
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/d/optout.

Reply via email to