GithubHelp home page GithubHelp logo

hashdog / mongoid-simple-tags Goto Github PK

View Code? Open in Web Editor NEW
57.0 57.0 24.0 64 KB

basic and simple tagging system for mongoid using map-reduce function

Home Page: http://hashdog.com

License: MIT License

Ruby 100.00%

mongoid-simple-tags's People

Contributors

ballou88 avatar bobclewell avatar chebyte avatar cmartyn avatar hendriklouw avatar lasseebert avatar lucasrenan avatar markbates avatar mirkojov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mongoid-simple-tags's Issues

Error on View Testing when all_tags method is used

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

TypeError - can't convert String into Integer

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

Return criteria instead of an array.

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?

call .scoped_tags on a criteria

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)

PS: Is this what calling @posts.all_tags would do?

Yes that's what it does... (I'll just leave this here to educate others)

Moped::Errors::OperationFailure | Error with .all_tags

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...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.