0
()구문 오류가 발생했지만 올바른 구문입니까? 예상치 못한 ''기대 ')'나는 중첩 된 형태를 가질
모델 아티스트 (예술가 사용자입니다) 아래
has_many :art_works
has_many :canvases
accepts_nested_attributes_for :art_works //artworks is what im currently working on
accepts_nested_attributes_for :canvases
컨트롤러 art_works
def new
@artist = Artist.find(params[:artist_id])
@artwork = @artist.art_works.build
respond_to do |format|
format.html # new.html.erb
format.json { render json: @artwork }
end
end
def create
@artwork = ArtWork.new(params[:artwork])
respond_to do |format|
if @artwork.save
format.html { redirect_to @artwork, notice: 'artwork was successfully created.' }
format.json { render json: @artwork, status: :created, location: @artwork }
else
format.html { render action: "new" }
format.json { render json: @artwork.errors, status: :unprocessable_entity }
end
end
end
작품보기를 참조 _form
<%= form_for(@artwork, :url => artist_art_works_path(current_artist) :multipart => true) do |f| %>
<p>
<%= f.file_field :art %>
</p>
<p>
<%= f.submit %>
</p>
<% end %>
나는 이것이 효과가있을 것이라고 매우 긍정적이었습니다. b 유 : 내 가정 : URL이 틀렸어? 나는 그것이 정말로 무엇이있을 것인지에 관해 정말로 명확하지 않다. 예술 작품에 대한 내 경로는 무엇입니까? 내 물건을 중첩하는 이유는 예술가가 예술 작품 모델에 아트를 업로드 할 수 있기 때문입니다. 아이디어는 하나의 작품에 여러 개의 예술 작품을 포함시키는 것입니다 (앨범에 이미지가 많이 있음)
artist_art_works GET /artists/:artist_id/art_works(.:format) art_works#index
POST /artists/:artist_id/art_works(.:format) art_works#create
new_artist_art_work GET /artists/:artist_id/art_works/new(.:format) art_works#new
edit_artist_art_work GET /artists/:artist_id/art_works/:id/edit(.:format) art_works#edit
artist_art_work GET /artists/:artist_id/art_works/:id(.:format) art_works#show
PUT /artists/:artist_id/art_works/:id(.:format) art_works#update
DELETE /artists/:artist_id/art_works/:id(.:format) art_works#destroy
도움을 주셔서 대단히 감사합니다. (noobness에 대한 사과)
세상에는 너무 많은 말 그대로이 하루 종일 쳐다보고 있었어요 감사합니다 – cdm89