0

public / imageフォルダーにある画像を表示しようとしていますが、その方法がわかりません。

私がやりたいのは、アーティストに写真を割り当てて、別のアーティストの写真をナビゲートできるようにすることです。

これは私の画像モデルです

class Image < ActiveRecord::Base
  has_many :publishings
  has_many :artists, :through => :publishings
  has_many :comments,:through => :friends

  has_many :comments, :as => :resource, :class_name => "Commentable"
end

これは私の画像ですshow.html

<p id="notice"><%= notice %></p>

<p>
  <b>Title:</b>
  <%= @image.title %>
</p>

<p>
  <b>Filename:</b>
  <%= @image.filename %>
</p>

<p>
  <b>Likes:</b>
  <%= @image.likes %>
</p>


<%= link_to 'Edit', edit_image_path(@image) %> |
<%= link_to 'Back', images_path %>

これは画像のデータベースです

class CreateImages < ActiveRecord::Migration
  def self.up
    create_table :images do |t|
      t.string :title :null => false
      t.string :filename :null =>false
      t.integer :likes :default =>0

      t.timestamps
    end
  end

  def self.down
    drop_table :images
  end
end 

前もって感謝します

4

1 に答える 1

2
<%= image_tag @image.filename %>
于 2012-05-05T18:15:27.013 に答える