【发布时间】:2011-05-17 17:30:04
【问题描述】:
我已经在我的应用程序中命名了我的模型和控制器。
当我尝试访问 admin/stories.html (NameSpace::Admin::StoriesController)
我不断收到错误消息“NameSpace is not missing constant Story!”
这是我的控制器的副本供参考:
class NameSpace::Admin::StoriesController < NameSpace::ApplicationController
layout "admin"
before_filter :admin_login_required
cache_sweeper NameSpace::StorySweeper, :only => [:update,:destroy]
# expose is provided by the DecentExposure Gem
expose(:stories) { current_place.stories.where(:state => %w{ submitted published }).order("created_at DESC").page(params[:page]).per(25) }
expose(:story)
def create
if params[:success] == "1"
Story.find_or_create_by_media_id(params[:media_id])
redirect_to admin_stories_url, :notice => "Successfully created story! It should appear here in a few minuntes once it's been processed."
else
flash.now[:error] = "There was an error when creating your story!<br>If this happens again, please contact support@#{APP_CONFIG[:domain]}".html_safe
render :new
end
end
def index
end
def show
end
def new
end
def edit
end
def update
if story.update_attributes(params[:story])
redirect_to admin_stories_url, :notice => "Successfully updated story."
else
render :action => 'edit'
end
end
def destroy
story.remove!
redirect_to admin_stories_url, :notice => "Story successfully destroyed!"
end
end
我正在使用带有 REE 的 Rails 3.1.0.beta1
【问题讨论】:
标签: ruby-on-rails-3 namespaces