nil类的未定义方法'map'

时间:2012-12-08 14:39:46

标签: mongodb ruby-on-rails-3.2 mongoid production

我是新手,在生产模式下使用mongodb(使用mongoid)运行rails 3服务器时遇到了一些麻烦。在开发模式下一切都很好,我无法弄清楚我错过了什么。请帮帮我,非常感谢你。这是错误:

  

ActionView :: Template :: Error(未定义的方法`map' for nil:NilClass):

2: #control{:style => "float: left;"}
3:   %h3= t(:manage_shop)
4:   =# debugger
=###### Already checking @shops variable but still got error ######
5:   = hidden_field_tag :shop_list, @shops.blank? ? "test" : @shops.to_json
6:   = form_tag("/shop", :method => "POST", :id => "frm_create_shop") do
7:     %table
8:       %tr
  

应用程序/视图/店铺/ index.html.haml:5:in`_app_views_shop_index_html_haml ___ 1855911541554609468_28040500'

这是我的行动:

def index
  @shops = Shop.all
  respond_to do |format|
    format.html
  end
end

我的模特:

class Shop
  include Mongoid::Document
  include Mongoid::Geospatial

  field :id,          type: Integer
  field :name,        type: String
  field :position,    type: Point, :spatial => true, :delegate => true

  spatial_scope :position
end

和我的production.rb配置:

Trunk::Application.configure do
  config.cache_classes = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_assets = false
  config.assets.compress = true
  config.assets.compile = false
  config.assets.digest = true
  config.i18n.fallbacks = true
  config.active_support.deprecation = :notify
end

第二件事是我无法从db获得任何东西,尽管在开发模式下一切都运行良好。如果您有任何建议,请帮助,谢谢。

0 个答案:

没有答案