我正在使用回形針和導軌。我遵循本教程: Multiple File Uploads with Paperclip & Rails 3 (Screencast)如何在一對多關係中鏈接到頁面?
我有一個畫廊模型,有很多galleryphotos。
而是鏈接到在我看來,原始圖像的,我創建了光象表演方法,但我得到了以下錯誤:
undefined method `galleryphoto_path' for #<#<Class:0x007f40a0000c20>:0x00000005385d60>
這裏是我的代碼:
<% for asset in gallery.galleryphotos %>
<%= link_to image_tag(asset.photo.url(:thumb)), url_for(asset) %>
<% end %>
這裏是我的galleryphoto控制器:
class GalleryphotosController < ApplicationController
load_and_authorize_resource
def show
@gallery = Gallery.find(params[:gallery_id])
@galleyphoto = @gallery.galleyphotos.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @gallery }
end
end
end
這裏是我的這些路線:
resources :galleries do
resources :galleryphotos
end
任何想法如何解決這個問題?
So處於PhotoImagesController Show方法? (但模型叫做galleryphoto)?想確保我有這個權利。 – 2012-07-06 01:32:07
@JesseWolgamott - 是的。我的控制器是GalleyphotosController – bigdaveyl 2012-07-06 01:46:49
這是代表你的routes.rb文件? – Rabbott 2012-07-06 03:22:46