I'm a newbie and I got some trouble when run rails 3 server with mongodb (using mongoid) in production mode. Everything is ok in development mode, and I cannot figure out what am I missing. Please help me, thank you very much. This is the error:
ActionView::Template::Error (undefined method `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
app/views/shop/index.html.haml:5:in`_app_views_shop_index_html_haml___1855911541554609468_28040500'
this is my action:
def index
@shops = Shop.all
respond_to do |format|
format.html
end
end
my model:
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
and my production.rb configuration:
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
And the second thing is I cannot get anything from db although everything is work well in development mode. If you have any suggestion, please help, thanks.