Displaying 20 results from an estimated 700 matches similar to: "Bundle install error involving hash range errors"
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
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
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 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
end
This works ok, but pushes out every attribute on the document
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 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"
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 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
2011 Nov 09
0
beginner question: how do I figure out why an app won't start? (RubyMine)
I''m building 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
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
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
2012 Jun 14
1
Cucumber/RSpec ::: Capybara? Webrat What am I using??
Hey everybody
I''m currently reading through the Pragmatic Programmers RSpec book, and
I really enjoy it.
But I’m facing some problems because of the fact that the book is
already some years old, I guess. I have installed rvm and use Ruby
1.9.3, and I didn’t really get some Rails code examples to work
properly, so I tried it with a 1.8.7 installation, but there I had some
other problems
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
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 Mar 29
0
Issue / code smell in AssociationProxy
I came across an issue in my code and after a hard debug session I
found something that smells.
First the context of my issue. I have a AR object that has a
polymorphic belongs_to currently tied to nothing, I want to dump it to
YAML.
record.to_yaml
This raises the following exception:
TypeError: wrong argument type nil (expected Data)
from
2007 Oct 07
1
How to store a Mechanize object in the database?
Hi,
I am trying to save a Mechanize object in database (using a Rails Model).
But the save operation throws a TypeError
Considering that "agent" is an instance of a Rails Model and "user" is
defined as a "text" type in the Model.
irb(main):039:0> agent.user = WWW::Mechanize.new
#<WWW::Mechanize:0xb71295f0 @follow_meta_refresh=false, @key=nil,
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:
2010 Dec 17
1
flash[;notice] not display after redirection
I read all previous posts about the same subject in Devise group but
couldn''t find any answer, so iy may not be related to Devise , so
I debugged it ..
.
class Users::RegistrationsController <
Devise::RegistrationsController
..
# POST /resource/sign_up
def create
build_resource
if resource.save
if resource.active?
set_flash_message :notice, :signed_up
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 -- :
2012 Mar 20
0
Setting cache_classes to false results in blank pages
Have anyone else stumbled upon this weird behavior? Setting the
config.cache_classes = false for development env causes rails to
return responses with totally empty content, headers seem to work ok.
It does not matter what the controller returns, even a simple :text =>
"OK" will result in empty page.
I''m using rails 3.2.2 and ruby 1.9.3.
It probably has something to do with