MongoMapper를 사용하여 레일즈 3 엔진을 만들려고합니다. 나는 고통의 세계를 가지고 가고 있습니다. 여기 내 모델 :MongoMapper로 레일즈 엔진 만들기
module GoodComments
class Comment
include MongoMapper::Document
key :comment, String
end
end
매우 간단, 나도 알아! 내 설정/routes.rb는 :
GoodComments::Engine.routes.draw do
resources :comments
end
내가 만든
설정/application.rb :
require File.expand_path('../boot', __FILE__)
module GoodComments
class Application < Rails::Application
config.generators do |g|
g.orm :mongo_mapper # :active_record
g.template_engine :erb # :haml
g.test_framework :rspec, :fixture => true, :views => false
g.fixture_replacement :factory_girl, :dir => "spec/factories"
end
end
end
내가
rails generate scaffold_controller Comment -o mongo_mapper
를 실행하고 내 컨트롤러가 생성되었다. 정의 GoodComments에서
LoadError :: CommentsController 번호 지수
예상 /Users/shamoon/Sites/good_comments/app/models/comment.rb : 내 서버를 실행하고 http://localhost:3000/good_comments/comments
에 갈 때, 오류가 발생합니다 Comment Rails.root :/사용자/shamoon/사이트/good_comments/test/dummy
도움이 필요하십니까?
좋아 .. 그것은 일종의 내가 제거하면 작동하는' GoodComments' 네임 스페이스 모델에서. 그러나 scaffold'new'는 모델 정의의 필드를 읽지 않습니다. – Shamoon