Created
April 13, 2012 07:31
-
-
Save lgs/2374848 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lsoave@ubuntu:~/rails/github/gitwatcher$ rails c | |
WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being defered until env.rb is called. | |
To avoid this warning, move 'gem cucumber-rails' under only group :test in your Gemfile | |
MONGODB [DEBUG] Logging level is currently :debug which could negatively impact client-side performance. You should set your logging level no lower than :info in production. | |
MONGODB (0ms) admin['$cmd'].find({:ismaster=>1}).limit(-1) | |
Loading development environment (Rails 3.2.3) | |
1.9.2p290 :001 > class Category | |
1.9.2p290 :002?> category = ["ruby", "web", "framework"] | |
1.9.2p290 :003?> def self.find_competitors(category) | |
1.9.2p290 :004?> #Competitor = Struct.new(:html_url, :description, :user) | |
1.9.2p290 :005 > competitors = [] | |
1.9.2p290 :006?> | |
1.9.2p290 :007 > #User.where('watchlists.tags_array' => %w[ruby web framework]).only(:nickname, :watchlists).each do |u| | |
1.9.2p290 :008 > User.where('watchlists.tags_array' => category).only(:nickname, :watchlists).each do |u| | |
1.9.2p290 :009 > #u.watchlists.where(:tags_array => %w[ruby web framework]).each do |wl| | |
1.9.2p290 :010 > u.watchlists.where(:tags_array => category).each do |wl| | |
1.9.2p290 :011 > competitors << Competitor.new(wl.html_url, wl.description, u.nickname) | |
1.9.2p290 :012?> end | |
1.9.2p290 :013?> end | |
1.9.2p290 :014?> return competitors | |
1.9.2p290 :015?> end | |
1.9.2p290 :016?> end | |
=> nil | |
1.9.2p290 :017 > category = ["ruby", "web", "framework"] | |
=> ["ruby", "web", "framework"] | |
1.9.2p290 :018 > @competitors = Category.find_competitors(category) | |
MONGODB (0ms) heroku_app1707530['system.namespaces'].find({}) | |
MONGODB (297ms) heroku_app1707530['users'].find({"watchlists.tags_array"=>["ruby", "web", "framework"]}, {:_type=>1, :nickname=>1, :watchlists=>1}) | |
MONGODB [DEBUG] cursor.refresh() for cursor 5269447330525612681 | |
=> [#<struct Competitor html_url="https://github.com/rails/rails", description="Ruby on Rails", user="lgs">, #<struct Competitor html_url="https://github.com/sinatra/sinatra", description="Classy web-development dressed in a DSL (official / canonical repo)", user="lgs">] | |
1.9.2p290 :019 > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment