Вопрос

this is my first development on rails, so Im still learning. I'm having a problem with mongoid_slug. In my local development mongoid_slug works fine, but when I test it on production I'm having this error:

uninitialized constant Mongoid::Slug This is my full trace: http://pastebin.com/7x0q5VwY

If I try to save the document error appears.

This is my GemFile:

gem 'rails', '4.0.0'

gem 'mongoid', '~> 4.0.0.beta1', github: 'mongoid/mongoid'

gem 'bson_ext'

gem 'cancan'

gem 'ckeditor'

gem 'mongoid_slug', '3.2'

gem 'sass-rails', '~> 4.0.0'

gem 'bootstrap-sass', '~> 3.1.1'

This is my model:

class Noticium

    include Mongoid::Document

    include Mongoid::Slug

    field :titulo, type: String

    slug :titulo, history: true

    field :contenido, type: String

    field :imagen, type: String

    field :imagen_url, type: String

    field :tipo, type: String

    field :fecha_registro, type: DateTime

    validates :titulo, uniqueness: true

    validates :titulo, :contenido, :imagen_url, :tipo, presence: true 

end

This is part of my controller where the error appears:

private

    def set_noticium
      @noticium = Noticium.find(params[:id])
    end

    def noticium_params
      params.require(:noticium).permit(:titulo, :contenido, :imagen, :tipo,
         :fecha_registro)
    end

I have read related info but I can't figure out what could be wrong. My website is hosted on Digital Ocean, I have checked the version of Rails, Ruby and mongodb they are the same that in my local machine.

Could someone help me to figure whats going on? Why on my local development the slug field is working and on production im having errors.

Thanks in advance.

Это было полезно?

Решение

Maybe the MongoID version?

http://rubygems.org/gems/mongoid_slug

Runtime Dependencies

mongoid > 3.0

And you are using Mongoid 4.0

Update: see this issue on Github: https://github.com/digitalplaywright/mongoid-slug/issues/30

My bad. Have to release master, which works without requiring the path, to RubyGems.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top