0
저는 Ruby on Rails를 처음 사용 했으므로 알려 주시기 바랍니다. 내 문제는 내가 브라우저에서 레일 프로젝트에 액세스 할 수 없다는 것입니다. 레일즈 설정과 관련이 있다고 가정하지만 지금까지 운이 없다. 나는 로직 (컨트롤러, 모델, 마이그레이션, ...)를 기존의 한레일 URL 액세스
- 프로젝트의는
주.
- index.html을 그대로두면 Rails가 URL을 구문 분석하기 전에 렌더링 페이지가 표시되기 때문에 Rails 시작 페이지가 표시됩니다.
- index.html을 사용하지 않으면 레일즈에서 생성 한 'Something went wrong'메시지가 나타납니다.
- httpd.conf 문서 루트가 'my.domain.com/public'으로 설정된 경우 레일즈 오류가 발생하지만 'my.domain.com/'으로 설정하면 오류가 발생합니다. 대신 아파치에 의해. (올바르게 구성된 것 같습니다.)
- 오류 로그에이 오류가 표시됩니다. URL을 누를 때
File does not exist: /var/www/html/my.domain.com/zombies
입니다.
내 환경
- 레일 3.2.6
- 루비 1.9.3
- 아파치 2.2.3
- 에 CentOS는
내가이 중요한 경우 좀비 용 Rails 튜토리얼을 따르기 만하면된다. 예 2.
미리 감사드립니다.
참조
zombies_controller.rb
class ZombiesController < ApplicationController
# GET /zombies
# GET /zombies.json
def index
@zombies = Zombie.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @zombies }
end
end
# GET /zombies/1
# GET /zombies/1.json
def show
@zombie = Zombie.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @zombie }
end
end
# GET /zombies/new
# GET /zombies/new.json
def new
@zombie = Zombie.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @zombie }
end
end
# GET /zombies/1/edit
def edit
@zombie = Zombie.find(params[:id])
end
# POST /zombies
# POST /zombies.json
def create
@zombie = Zombie.new(params[:zombie])
respond_to do |format|
if @zombie.save
format.html { redirect_to @zombie, notice: 'Zombie was successfully created.' }
format.json { render json: @zombie, status: :created, location: @zombie }
else
format.html { render action: "new" }
format.json { render json: @zombie.errors, status: :unprocessable_entity }
end
end
end
# PUT /zombies/1
# PUT /zombies/1.json
def update
@zombie = Zombie.find(params[:id])
respond_to do |format|
if @zombie.update_attributes(params[:zombie])
format.html { redirect_to @zombie, notice: 'Zombie was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @zombie.errors, status: :unprocessable_entity }
end
end
end
# DELETE /zombies/1
# DELETE /zombies/1.json
def destroy
@zombie = Zombie.find(params[:id])
@zombie.destroy
respond_to do |format|
format.html { redirect_to zombies_url }
format.json { head :no_content }
end
end
end
라우팅 설정이 있습니까? webrick 개발 서버를 사용하고 있습니까? –
다음 경로가 정의되어 있습니다. 'resources : zombies','root : to => '좀비 #index'. WEBrick을 사용해 보았지만 도움이되지 않아서 이제는 Apache를 종료하거나 Apache를 종료했습니다. – Donnie
나는 다음과 같이 도메인을 시도했다. 'http : //my.domain.com : 3000/zombies'와'http : // my.domain.com/zombies'. WEBrick 또는 Apache 실행과 관계없이 항상 동일한 결과를 얻습니다. – Donnie