mongoid

MongoDB ReplicaSet Authentication Issue with Secondary

北战南征 提交于 2019-12-11 07:03:13
问题 We have a MongoDB (v 3.2.8) replicaSet with the following configuration: replication: replSetName: replica security: keyFile: mongo.key Our replicaSet status rs.status() currently looks like this: { "set" : "replica", "date" : ISODate("2016-11-11T15:43:29.164Z"), "myState" : 1, ... "members" : [ { "_id" : 4, "name" : "mongo_1:27017", "health" : 1, "state" : 1, "stateStr" : "PRIMARY", "uptime" : 155, ... "self" : true } { "_id" : 5, "name" : "mongo_2:27017", "health" : 1, "state" : 1,

ActionView::Template::Error (undefined method `getlocal' for “2008-02-14T02:20:50Z”:String):

邮差的信 提交于 2019-12-11 06:28:41
问题 After updating Mongoid 3.0.1 / Rails 3.2.6 it start getting a 'getlocal' method error when displaying created_at : Showing /home/lsoave/rails/github/gitwatcher/app/views/shared/_watch-list-table.html.haml where line #28 raised: undefined method `getlocal' for "2008-02-14T02:20:50Z":String Extracted source (around line #28): 28: %td= repo.created_at.to_s(:pretty) UPDATE I've got a config/initializers/time_formats.rb which set that format $ cat config/initializers/time_formats.rb Time::DATE

Trouble installing Mongoid with Rails 3 on Windows

自古美人都是妖i 提交于 2019-12-11 05:26:48
问题 In my Gemfile: gem "mongoid", "~> 2.3" gem "bson_ext", "~> 1.4" When I run bundle install I get the error below: Bundler could not find compatible versions for gem "activemodel": In Gemfile: mongoid (~> 2.3) x86-mingw32 depends on activemodel (~> 3.1) x86-mingw32 rails (= 3.0.6) x86-mingw32 depends on activemodel (3.0.6) I've tried pointing to github for the version, as is suggested in some other posts, but when I do this and run bundle install , I get another error: Fetching http://github

Bundler: “Could not find bson-1.4.0 in any of the sources”

安稳与你 提交于 2019-12-11 04:56:03
问题 I'm trying to do a bundle install but I'm getting the error Could not find bson-1.4.0 in any of the sources . I believe bson-1.4.0 is a requirement for mongoid ~> 2.0 which is in my Gemfile. When I try gem install -v 1.4.0 bson , I get the error ERROR: Could not find a valid gem 'bson' (= 1.4.0), here is why: Found bson (1.4.0), but was for platform jruby the bundle install works fine on my development machine (running OSX 10.6.8), but I'm having this problem on a 64-Bit Amazon EC2 instance.

adapt impressionist gem to mongoid

走远了吗. 提交于 2019-12-11 04:44:28
问题 I'm trying adapt this gem, https://github.com/charlotte-ruby/impressionist to mongoid odm. I have been seeing the commit for mongo_mapper in https://github.com/tute/impressionist/commit/1c3f809da8ebd3ced8cb9bda8caee89012091a10. This is impression.rb model for mongoid: class Impression include Mongoid::Document include Mongoid::Timestamps::Created field :impressionable_type, :type => String field :impressionable_id, :type => String field :user_id, :type => String field :controller_name, :type

Mongomapper documentation?

喜欢而已 提交于 2019-12-11 04:31:59
问题 I have stumbled upon Mongoid which has great documentation: http://mongoid.org/docs/associations/ But I have heard that MongomMapper is de-facto for Rails. Where do I find API documentation for using Mongomapper? 回答1: The standard answer from the author of MongoMapper is that the project is still young and that the API is still in flux. Download the latest version from Git and look at the tests. You should be able to get a fair idea of what is possible. 回答2: It's up on rdoc.info now: http:/

Rails 3 respond_with, route constraints and resources

强颜欢笑 提交于 2019-12-11 04:19:47
问题 I'm building a versioned API, so I have the following nested controllers: ApiController < ApplicationController Api::V1Controller < ApiController Api::V1::EventsController < Api::V1Controller The API is accessed via a subdomain. I have the following routes: constraints(:subdomain => "api") do scope :module => 'api' do namespace :v1 do resources :events end end end This produces the type of URL I want (/v1/events). The problem I'm facing is when using responds_with in Api::V1::EventsController

Heroku not using the specified Ruby 1.9.3

那年仲夏 提交于 2019-12-11 03:48:18
问题 Upgrading to Mongoid 3 and Ruby 1.9.3. Trying to use Ruby 1.9.3 on Heroku Cedar Stack. I have added the below to the top of my Gemfile: source 'http://rubygems.org' ruby "1.9.3" Pushing to Heroku, it seemed to be working -----> Heroku receiving push -----> Ruby/Rails app detected -----> Using Ruby version: ruby-1.9.3 -----> Installing dependencies using Bundler version 1.2.0.rc.2 However my app is breaking as it requires Ruby 1.9.3. The error is coming as: TypeError: can't convert Array into

Embedded or referenced relations

≡放荡痞女 提交于 2019-12-11 03:45:54
问题 I use mongodb and mongoid gem and I'd like to get some advice. I have an app where User has many Markets and Market has many Products. I need to search for the products, say in a specific price range, in all (or any) the markets which belong to the user. Which relation fits better for this, embedded or referenced? I currently use referenced and it looks like so class User has_many :markets end class Market belongs_to :user has_many :products end class Product belongs_to :calendar belongs_to

Carrierwave + Mongoid + gridfs + Padrino admin image upload

爷,独闯天下 提交于 2019-12-11 02:49:44
问题 i'm trying to get carrierwave + mongoid + gridfs to work for uploading images via padrino admin and then showing on front-end. at a loss as to glue everything. can someone help? following https://blog.engineyard.com/2011/a-gentle-introduction-to-carrierwave/ and https://github.com/carrierwaveuploader/carrierwave-mongoid. trying to persist an "Artwork" with an image upload returns: NoMethodError at /admin/artworks/update/53a0eedcf2c7961066000002 undefined method ` bson_dump ' for # file: hash