2013-11-25 4 views
0

나는 스페인어로 모든 모델 이름으로 응용 프로그램을 만들고 있습니다. 특이점 화와 관련된 몇 가지 이상한 문제가 있습니다. 내 모델 :보기보기에 이상한 경로 behaivor

class Artista < ActiveRecord::Base 
    attr_accessible :fecha, :foto, :instrumento, :nombre 
end 

내 모델 이름은 단수에서 "예술가"(작가)입니다.

컨트롤러 :

class ArtistasController < ApplicationController 
    # GET /bandas 
    # GET /bandas.json 
    def index 
    @artistas = Artista.all 

    respond_to do |format| 
     format.html # index.html.erb 
     format.json { render json: @artistas } 
    end 
    end 

    def show 
    @artista = Artista.find(params[:id]) 

    respond_to do |format| 
     format.html # show.html.erb 
     format.json { render json: @artista } 
    end 
    end 
    def new 
    @artista = Artista.new 

    respond_to do |format| 
     format.html # new.html.erb 
     format.json { render json: @artista } 
    end 
    end 

    def edit 
    @artista = Artista.find(params[:id]) 
    end 

    def create 
    @artista = Artista.new(params[:artista]) 

    respond_to do |format| 
     if @artista.save 
format.html { redirect_to @artista, notice: 'Artista was successfully created.' } 
     format.json { render json: @artista, status: :created, location: @artista } 
     else 
     format.html { render action: "new" } 
     format.json { render json: @artista.errors, status: :unprocessable_entity } 
     end 
    end 
    end 

    def update 
    @artista = Artista.find(params[:id]) 
    respond_to do |format| 
     if @artista.update_attributes(params[:banda]) 
     format.html { redirect_to @artista, notice: 'Artista was successfully updated.' } 
     format.json { head :no_content } 
else 
     format.html { render action: "edit" } 
     format.json { render json: @artista.errors, status: :unprocessable_entity } 
     end 
    end 
end 
    def destroy 
    @artista = Artista.find(params[:id]) 
    @artista.destroy 
    respond_to do |format| 
     format.html { redirect_to artistas_url } 
     format.json { head :no_content } 
    end 
    end 
    end 

(이 자동으로 레일 생성 생성 된 명령)

지금, 내 경로는 다음과 같습니다 :

resources :artistas 

내가 localhost:3000/artistas 모든 액세스 훌륭하게 작동합니다. 이미 생성 된 aritst의 목록을 볼 수 있습니다. 이제 기존 아티스트를 클릭하면 (또는 내가 아티스트 페이지로 리디렉션되어 새로운 아티스트 페이지를 만들려고 시도한 후) 이상한 이유로 http://localhost:3000/artistum.3 (3 번은 내가 클릭 한 아티스트의 ID 임)으로 이동합니다. 해당 URL에 대한 출력은 완전히 공백 페이지입니다.

나는 아티스트라는 단어를 입력 한 적이 없습니다. 나는 그것이 어디에서 났는지 모른다. 게다가, 그것은 슬래시 대신 아이디에서 이름을 분리하는 점이 있으므로, 어떻게 방향을 바꿔야할지 모르겠다.

나는 모든 것을 포함하고있는 폴더의 grep 검색을 실행했고, artistum이라는 단어는 로그 파일에만 존재합니다.

내 응용 프로그램의 일부는 "예술가"가 복수형이고 "예술가"가 단수 형태라고 생각합니다.

내 경로 match '/artistum' => 'artistas#index'에 추가했는데 인덱스 페이지에서 작동하지만 표시 페이지에서 그 점을 혼란스럽게합니다.

누가 나를 도울 수 있습니까? A) 왜 거기에 가려고하는지, b) 그 쇼 페이지에서 어떻게 길을 찾을 수 있습니까? 감사합니다.

+0

어떻게'Artista'처럼 각각의 클릭은'link_to' 보입니까? –

답변

2

이 작업을 시도 할 수 :

config/initializers 폴더에 inflections.rb이 추가 :

ActiveSupport::Inflector.inflections do |inflect| 
    inflect.plural 'artista', 'artistas' 
    inflect.irregular 'artista', 'artistas' 
end