すべてのモデル名がスペイン語のアプリケーションを作成しています。特異化に関連する奇妙な問題がいくつかあります。私のモデル:
class Artista < ActiveRecord::Base
attr_accessible :fecha, :foto, :instrumento, :nombre
end
私のモデル名は単数形の「artista」(アーティスト)です。
コントローラ:
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
(これはすべて rails generate コマンドで自動的に作成されています)
現在、私のルートには次のものが含まれています。
resources :artistas
私がアクセスするとlocalhost:3000/artistas
、すべてがうまく機能します。作成済みのアーティストの一覧が表示されます。ここで、既存のアーティストをクリックすると (または新しいアーティストを作成しようとした後、ショー アーティストのページにリダイレクトされます)、何らかの奇妙な理由でhttp://localhost:3000/artistum.3
(3 はクリックしたアーティストの ID です) になります。その URL の出力は、完全に空白のページです。
私はartistumという言葉をタイプしたことさえありません。どこから入手したのかわからない。その上、名前とIDを区切るためにスラッシュの代わりにドットがあるため、リダイレクトする方法がわかりません。
すべてを含むフォルダーのgrep検索を実行しましたが、artistumという単語はログファイルにのみ存在します。
私の推測では、アプリケーションの一部で、「artista」が複数形で「artistum」が単数形であると考えられているようです。
私は自分のルートに追加しましたmatch '/artistum' => 'artistas#index'
が、それはインデックスページでは機能しますが、ドットはショーページでそれを行う方法について混乱しています.
誰かが私を助けることができますか? A) なぜそこに行こうとしているのか、または b) それらのショーページからルーティングする方法を見つけることができますか? ありがとう!