ActionController :: RoutingError (No routes match [GET] "/ system / images / assets / small / IMG _-_ WIN_20141206_09
I am trying to load an image into my rails app but it gives me
error: - (No route matches [GET] "/ System / Photos / Assets / Small / Image _-_ WIN_20141206_09.
I don't know where I went wrong. I am trying to specify url, path and I also downloaded the rails logo and moved toapp/assets/images
$ curl -O
http://rubyonrails.org/image/rails.png
$ mv rails.png app/assets/images/
My git repository is at: https://github.com/sarahgupta022/book.git
This is my picture.rb
class Picture < ActiveRecord::Base
belongs_to :album
belongs_to :user
attr_accessible :caption, :description, :asset
has_attached_file :asset, style: {
large: "800x800>", medium: "300x200>", small: "260x180>", thumb: "80x80#"
} , :default_url => "/app/assets/images/small/rails.png"
validates_attachment_file_name :asset, :matches => [/png\Z/, /jpe?g\Z/, /gif\Z/]
validates :asset, attachment_presence: true
def to_s
caption? ? caption : "Picture"
end
end
This is my views/pictures/index.html.erb
<% @pictures.each do |picture| %>
<li>
<div class="thumbnail">
<%= link_to image_tag(picture.asset.url(:small)), album_picture_path(@user, @album, picture) %><br /><br />
<div class="caption">
<% if picture.caption? %><%= picture.caption %><br /><br /><% end %>
<%= link_to 'View full size', album_picture_path(@user, @album, picture) %>
<% if can_edit_picture?(picture) %>
<%= link_to "Edit", edit_album_picture_path(@album, picture) %>
<%= link_to "Delete", album_picture_path(@album, picture), method: :delete, data: { confirm: "Are you sure?" } %>
<% end %>
</div>
</div>
</li>
Thanks a lot for any help. Thank!
source to share
No one has answered this question yet
Check out similar questions: