ruby - Can't use conditions on symbols. DataMapper with Sinatra -
i'm getting troubles when trying use conditions on symbols in datamapper:
clusters = cluster.all(:latitude.not => nil)
this code throws error:
argumenterror - condition #<origin::key:0x50d05a0 @name=:latitude, @strategy=:__override__, @operator="$not", @expanded=nil, @block= nil> of unsupported object origin::key: c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:888:in `block in assert_valid_conditions' c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:853:in `each' c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:853:in `assert_valid_conditions' c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:776:in `block in assert_valid_options' c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:766:in `each' c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:766:in `assert_valid_options' c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:363:in `update' c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:386:in `merge' c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/model.rb:767:in `scoped_query'
cluster model class:
class cluster include datamapper::resource property :id, serial property :city_id, integer property :name, string property :latitude, float property :longitude, float end
core gem versions i'm using: sinatra
- 1.4.6, data_mapper
- 1.2.0.
what can wrong code? can't resolve error.
Comments
Post a Comment