0
Ich habe erfolgreich Paperclip gem installiert und ein Bild auf meinen Beitrag hochgeladen, aber in Show-Aktion gibt es kein Bild, nur alt Text mit Bild alt.Paperclip gem zeigt keine Bilder
Ich bin mit Ruby on Rails 3.2.1
@post Form:
<% create_url = {:url=>{:action=>"create"}} if @post.new_record? %>
<% form_for @post, :html => { :multipart => true } do |t| %>
<b><%= t.label :title, 'Virsraksts:' %></b><br />
<%= t.text_field :title %><br /><br />
<b><%= t.label :content, 'Teksts:' %></b><br />
<%= t.text_area :content %><br /><br />
<%= f.file_field :bildes %>
<div class="actions">
<%= t.submit %>
</div>
@post zeigen:
<p><%= @post.content %></p>
<%= image_tag @post.bildes.url %>
<%= image_tag @post.bildes.url(:medium) %>
<%= image_tag @post.bildes.url(:thumb) %>
Meiner Meinung nach @ Post Model URL und Pfad ist nicht richtig, b genau das, was ich nicht weiß.
@post Modell:
class Post < ActiveRecord::Base
has_attached_file :bildes, :styles => { :medium => "300x300>", :thumb => "100x100>" },
:url => ":rails_root/app/assets/bildes/:id/:style/:basename.:extension",
:path => ":rails_root/app/assets/bildes/:id/:style/:basename.:extension"
end
Ja, ich hatte Recht! Problem ist in meiner URL und mit Ihrer Hilfe jetzt weiß ich das. Vielen Dank! Aber wie kann ich die richtige URL machen? – RydelHouse
Der erste Ort, an dem ich nachsehen würde ist Büroklammer Wiki :) – ramigg
Ich mache das, aber jedes Mal vermisse ich etwas. Trotzdem danke! :) – RydelHouse