similar to: Using Mongoid with ActiveRecord

Displaying 20 results from an estimated 200 matches similar to: "Using Mongoid with ActiveRecord"

2011 Jul 04
2
when use mongoid , Model.count can't work.
Hi, when i use mongoid to get the count of model named "User", I met a error : irb(main):001:0> User.count ArgumentError: wrong number of arguments (1 for 0) from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/ cursor.rb:37:in `count'' from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/ cursor.rb:37:in `send'' from
2013 Oct 23
2
how is mongoid syntax implemented ?
In mongoid, a ORM mapped database object is like below. The part "type: String" seems to me to not fit into any standard ruby syntax and I was curious how does mongoid implement that ? class Step include Mongoid::Document field :Label, type: String field :Descript, type: String field :ErrorText, type: String embedded_in :step_data end -- You received this message
2011 Jun 09
2
nginx + passenger + mongoid
When I set the rails_env to production in nginx.conf I get: Error message: db_name must be a string or symbol -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to
2011 May 04
5
rails mongoid
I have a strange problem. Suppose I have a user model with only name field. I can add a field with value by creating an instance in mongodb rails environment. Example: class User include Mongoid::Document field :name end Now in rails console, If you do user = User.new user[:name] = "xxxx" user[:firstname] = "yyyy" user.save The record gets created with name and
2010 Sep 23
0
rspec problems mocking classes based on mongoid
I am getting errors when running my rspecs. My project uses rails 3, mongoid, factory_girl, rspec 2.0.0.beta.22, rspec-mocs, etc http://pastebin.com/raw.php?i=WkaGiFag Getting: Failure/Error: @product = assign(:product, stub_model(Product, undefined method `to_sym'' for nil:NilClass I''m pretty sure stub_model has no clue on how to handle objects based on mongoid. Any ideas?
2011 May 08
0
Mongoid rails 3
Hi, I am using mongoid, rails, mongohq. I have to tables Category and SubCategory Category references_many :subcategories SubCategory referenced_in :category Now I have a form in view. In view, when user chooses a category, an ajax request is made to get dependent subcategories. But problem is, it is returning empty array in response(this is using mongohq). It is working normally as expected
2006 Mar 22
2
Controller instance variables falling in and out of scope
Very bizarre behavior has cropped up in a few spots. # the action for viewing a blog post def posts @post = BlogPost.find_by_slug(params[:id], :include => :commentary) # a breakpoint here shows @post and @post.commentary with appropriate data redirect_to :action => ''archive'' unless @post end # posts.rhtml <%= @post.inspect %> => nil <%= render :partial
2009 Apr 05
1
[cucumber] Nested resource in paths.rb
Hello Rspec Users, I was wondering how you specify a nested resource in cucumber. So for example: Given I have a blogpost titled Question For Nice Rspec Users When I am on the list of comments for Question For Nice Rspec Users Then I should see "Answer" Now, as one might expect, blogpost has_many :comments, so my question is this: How should I write the "when-case" for
2014 Mar 10
0
Mongoid : bson namespace error
Hello All, I had been trying to work on Rails 4 and Mongoid gem. The following are the versions I had installed: bson-2.2.1 mongoid-3.1.6 After installing and trying to run "rails generate" command. It is failing with NameSpace error for BSON::ByteBuffer. It is trying to connect to mongodb server initially and getting successful. Post that it is failing with the following
2011 Nov 09
3
Mongo adapter
I have setup mongo database and want to know which one would be best adapter ( mongo_mapper , mongoid, dm-mongo-adapter ) in terms of Associations, include option for eager-loading . -- Regards Mukesh Paras Singh -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2011 Aug 05
5
Best Mongo Framework to work with Rails
Hi all, Wanted to hear your opinions about the currently best option for mongo with Rails. Thank you all in advance, Vasco Andrade e Silva -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2012 Jun 12
2
how to connect rails app using monodb
hi all i ve installed monodb this is the first time ive installed it and don''t have any idea how to use it. previously ive used MYSQL for my apps. now i want to use monodb . can any one help me out how to use monodb . does it have any interface just as MYSQL. as there is no yml file needed how do i connect my app thanks in advance -- You received this message because you
2011 Feb 27
10
How to store the same key multi times in a Hash ?
given an Arra tags[] I need to produce a resulting Hash as following .. { "$in" => [tags[0]], "$in" =>[tags[1], ...} in which the key should be always the same and the value being an Array I tried this : myHash = {} tags.each do |tag| h = {"$in" => [tag]} myHash.merge!(h) end but the merge! is only
2011 Jul 05
4
Problem of "rake spec"
Hi all, I am a bit confused when i type rake spec and it gives me this message, No examples matching ./spec/**/*_spec.rb could be found what is that mean that something is not found. and where i can input my the test code because i did have a tiny sample code in user_controller_test.rb. is that the right place to test functional.. plz give me a help thanks -- You received this message
2011 May 14
1
RSpec stub question
Hi I am using Mongoid. In Mongoid while saving a record we typically give like in the controller @post.safely.save For a model class Post I am writing rspecs for my controller and want to mock the model. So what I am doing is let(:post) { mock_model(Post).as_null_object } before(:each) do Post.stub(:new).and_return(post) end it "creates new post"
2011 Dec 06
1
mongodb topic in rails
Hi I use mongoid for rails application and I try to do @users = User.where("first_name = ? OR last_name = ? OR type = ?", firstname, lastname, usertype) but I am getting error but when i put: @users = User.where(:first_name => firstname, :last_name => lastname, :type => usertype).all the program run successfully but i need OR to execute in mongodb Also I need sql LIKE to
2010 May 27
4
[PATCH] Rails 3: fields_for helper doesn't work with association proxy objects
Request for eyeballs. :-) Mongoid uses association proxy objects. It overrides #nil? => false when the association is missing. However since it uses proxy objects, !!assocation is always true. I have created a ticket with a patch that changes the association nil test to call assocation.nil? rather than use implicit coercion of the variable. See:
2012 Jan 24
7
Gem install bundler works, gem bundle doesn't?
Hi, I''m having some trouble with bundler: -bash-4.1$ gem install bundler Successfully installed bundler-1.0.21 1 gem installed Installing ri documentation for bundler-1.0.21... Installing RDoc documentation for bundler-1.0.21... -bash-4.1$ bundle install ERRRO: Gem bundler is not installed, run `gem install bundler` first. -- You received this message because you are subscribed to the
2011 Mar 02
6
calbacks on models
Hi, I''m having some strange behavior on callbacks when testing with RSpec2. On my test, when I create a resource using the #create method the callbacks related to #before_create are not called. If I go to the console and I try to type the command Resource.create(client_uri: "http://example.com") all works fine. There are no mocks around, and I can''t understand if this
2012 Dec 05
3
Fwd: Issue starting unicorn with non-ActiveRecord Rails app
Hi, I''m trying to use unicorn in a test deployment of a Rails app that uses Mongoid, so Activerecord isn''t included in the app. When I start unicorn through Capistrano though, the stderr log fills up endlessly with identical ActiveRecord-related errors: I, [2012-12-05T04:19:25.375952 #5096] INFO -- : Refreshing Gem list I, [2012-12-05T04:19:32.941249 #5096] INFO -- :