search for: mongoid

Displaying 20 results from an estimated 28 matches for "mongoid".

Did you mean: mongod
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...
2012 Jan 22
3
Using Mongoid with ActiveRecord
I''m trying to use mongodb and postgresql simultaneously with Rails 3.1. I believe I have everything set up correctly. What I''m interested in knowing is how to get rails to flip-flop back- and-forth between mongoid and activerecord. For example, if I want to generate an ActiveRecord model after using mongoid, rails automatically defaults to the Mongoid gem. > rails g model Blogpost invoke mongoid create app/models/blogpost.rb invoke rspec create spec/models/blogpost_spec.rb How wou...
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 :...
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...
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 firstname fields. But i havent declared firstname field in model. Can anyone please help me out. Than...
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 ar...
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 rubyonrails-talk-/JYPxA39Uh5TL...
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
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 i...
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 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...
2010 Feb 25
0
Bundle install error involving hash range errors
While running "bundle install" on a new Rails3.0.0.beta app on Ubuntu 9.10 / Ruby 1.8.7 with the following line in my Gemfile: gem "mongoid", :git => "git://github.com/durran/mongoid.git", :branch => "prerelease" I got the following error: Installing mongoid (2.0.0.pre) from git://github.com/durran/mongoid.git (at prerelease) /usr/lib/ruby/1.8/yaml.rb:389:in `hash'': no implicit conversion from...
2011 Feb 03
0
Correct way to exclude attributes from json serialization
Hi I''m using Mongoid and Rails 3, and I want to serialize one of my mongoid documents to json for publishing via a controller, e.g. class ReportController < ApplicationController respond_to :json def show report = Report.where(:report_id => params[:id]).first respond_with report end...
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 progra...
2011 Mar 02
6
calbacks on models
...he 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 is a normal behavior using RSpec, if its due to Mongoid or something else. # resource.rb (model) class Resource include Mongoid::Document before_create :random_code, :create_expiration # resource_rspec.rb (testing suite) let(:resource) { Resource.create(client_uri: "http://example.com") Thanks a lot -- Posted via http:/...
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
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...
2011 Nov 09
0
beginner question: how do I figure out why an app won't start? (RubyMine)
...ding a new Ruby app with RubyMine. I built a basic app (just a homepage) and it is running fine. Next step is to get the app talking to MongoDb. I''m using this tutorial: http://www.mongodb.org/display/DOCS/Rails+3+-+Getting+Started also tried this one: https://github.com/RailsApps/rails3-mongoid-devise The problem is, after running through the tutorial and starting my app, nothing happens. Mongrel boots up fine: D:\Ruby193\bin\ruby.exe -e $stdout.sync=true; $stderr.sync=true;load($0=ARGV.shift) D:/Ruby193/lib/ruby/gems/1.9.1/ gems/ruby-debug-ide-0.4.17.beta8/bin/rdebug-ide --port 8051 --...