hashdog / mongoid-simple-tags Goto Github PK
View Code? Open in Web Editor NEWbasic and simple tagging system for mongoid using map-reduce function
Home Page: http://hashdog.com
License: MIT License
basic and simple tagging system for mongoid using map-reduce function
Home Page: http://hashdog.com
License: MIT License
I don't know if that is a Problem with mongoid-simple-tags for sure, but maybe u can help me.
At the moment i'm testing my views with Capybara (1.1.2) and Rspec (2.11.0). When i use the all_tags method of mongoid-simple-tags in my controller i get the following error message:
Failures:
1) Admin::Builds Project Management adds a new Build
Failure/Error: visit admin_project_builds_path(project)
Moped::Errors::OperationFailure:
The operation: #<Moped::Protocol::Command
@length=592
@request_id=6
@response_to=0
@op_code=2004
@flags=[]
@full_collection_name="kw_app_distribution_test.$cmd"
@skip=0
@limit=-1
@selector={:mapreduce=>"builds", :map=>"\n function() {\n if(this.tags){\n this.tags.forEach(function(tag){\n emit(tag, 1)\n });\n }\n }\n ", :reduce=>"\n function(key, values) {\n var tag_count = 0 ;\n values.forEach(function(value) {\n tag_count += value;\n });\n return tag_count;\n }\n ", :query=>{}, :orderby=>{"created_at"=>-1}, :out=>{:inline=>true}}
@fields=nil>
failed with error "ns doesn't exist"
# ./app/controllers/admin/builds_controller.rb:11:in `index'
# ./spec/requests/admin/builds_spec.rb:12:in `block (3 levels) in <top (required)>'
If i replace the all_tags method with a simple array ( [name: "test"] ) everything works fine.
Do u have any ideas where i can start to search for the problem?
Thanks, Matthias
When i upgraded mongoid-simple-tags gem version from "0.1.1" to "0.1.2", it was throwing "TypeError - can't convert String into Integer" for my existing model while i tried to access "model.tags"
For example
user.tags
TypeError - can't convert String into Integer
But downgrading to version "0.1.1" works fine
Is there a specific reason why you call to_a on the tagged_with result and not let it return a criteria, which can be used for chaining queries?
the api provided by mongoid changed a lot in v3.
For example, if I have
@posts = Post.where(:live => true)
I would like to do
@tags = @posts.scoped_tags # should really be @posts.all_tags
instead of
@tags = Post.scoped_tags(:live => true)
Yes that's what it does... (I'll just leave this here to educate others)
The operation: #<Moped::Protocol::Command
@length=557
@request_id=4
@response_to=0
@op_code=2004
@flags=[]
@full_collection_name="pracker_development.$cmd"
@skip=0
@limit=-1
@selector={:mapreduce=>"pixels", :map=>"\n
function() {\n
if(this.tags){\n
this.tags.forEach(function(tag){\n
emit(tag, 1)\n
});\n
}\n
}\n ", :reduce=>"\n
function(key, values) {\n
var tag_count = 0 ;\n
values.forEach(function(value) {\n
tag_count += value;\n
});\n
return tag_count;\n
}\n ", :query=>{}, :out=>{:inline=>true}}
@fields=nil>
failed with error 9014: "exception: map invoke failed: JS Error: TypeError: this.tags.forEach is not a function nofile_b:2"
See https://github.com/mongodb/mongo/blob/master/docs/errors.md
for details about this error.
With Pixel.all_tags this error occurs
I had this in the past, but the only solution I could come up with was to delete the collection and start over...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.