Witam wszystkich. Jestem poczatkujacym uzytkownikiem (programista? :O) RoR. Stworzylem dla siebie pewna aplikacje, ktora sam chce wykorzystywac. Chcialbym ja na poczatku odpalic na Heroku z racji latwosci obslugi. Zgodnie z zaleceniami zalozylem takze konto na Amazon AWS i zarejestrowalem sie do S3, aby wrzucac tam obrazki potrzebne do mojej strony. Probuje teraz polaczyc moja aplikacje za pomoca paperclipa z moim kontem S3 i niestety podczas odpalania http://localhost:3000/images dostaje taki blad:
ArgumentError in Images#index
Showing app/views/images/index.html.erb where line #19 raised:
syntax error on line 0, col 39: `bucket: (tutaj nazwa bucketu)
access_key_id: (tutaj access key id)
secret_access_key: (a tutaj oczywiscie secret access key)
’
Extracted source (around line #19):
16:
17:
18:
19: <% if image.img.exists? then %>
20:
<%= image_tag image.img.url(:thumb) %>
21: <% else %>
22:
There are no photo’s attached, upload one.
RAILS_ROOT: C:/Users/Mariusz/Sites/wiw_development
Application Trace | Framework Trace | Full Trace
C:/Ruby/lib/ruby/1.8/yaml.rb:133:in load' C:/Ruby/lib/ruby/1.8/yaml.rb:133:in
load’
C:/Users/Mariusz/Sites/wiw_development/vendor/plugins/paperclip/lib/paperclip/storage.rb:236:in find_credentials' C:/Users/Mariusz/Sites/wiw_development/vendor/plugins/paperclip/lib/paperclip/storage.rb:176:in
parse_credentials’
C:/Users/Mariusz/Sites/wiw_development/vendor/plugins/paperclip/lib/paperclip/storage.rb:138:in extended' C:/Users/Mariusz/Sites/wiw_development/vendor/plugins/paperclip/lib/paperclip/storage.rb:137:in
instance_eval’
C:/Users/Mariusz/Sites/wiw_development/vendor/plugins/paperclip/lib/paperclip/storage.rb:137:in extended' C:/Users/Mariusz/Sites/wiw_development/vendor/plugins/paperclip/lib/paperclip/attachment.rb:269:in
extend’
C:/Users/Mariusz/Sites/wiw_development/vendor/plugins/paperclip/lib/paperclip/attachment.rb:269:in initialize_storage' C:/Users/Mariusz/Sites/wiw_development/vendor/plugins/paperclip/lib/paperclip/attachment.rb:51:in
initialize’
C:/Users/Mariusz/Sites/wiw_development/vendor/plugins/paperclip/lib/paperclip.rb:326:in new' C:/Users/Mariusz/Sites/wiw_development/vendor/plugins/paperclip/lib/paperclip.rb:326:in
attachment_for’
C:/Users/Mariusz/Sites/wiw_development/vendor/plugins/paperclip/lib/paperclip.rb:229:in img' C:/Users/Mariusz/Sites/wiw_development/app/views/images/index.html.erb:19:in
_run_erb_app47views47images47index46html46erb’
C:/Users/Mariusz/Sites/wiw_development/app/views/images/index.html.erb:12:in each' C:/Users/Mariusz/Sites/wiw_development/app/views/images/index.html.erb:12:in
_run_erb_app47views47images47index46html46erb’
C:/Users/Mariusz/Sites/wiw_development/app/controllers/images_controller.rb:7:in `index’
Tak wygladaja moje pliki:
- app/views/images/index.html.erb
Listing images
Id | File Name | Created at | Updated at | Img | |||
---|---|---|---|---|---|---|---|
<%=h image.id %> | <%=h image.img_file_name %> | <%=h image.created_at %> | <%=h image.updated_at %> |
<% if image.img.exists? then %>
<%= image_tag image.img.url(:thumb) %> <% else %>There are no photo's attached, upload one. <% end %> |
<%= link_to 'Show', image %> | <%= link_to 'Edit', edit_image_path(image) %> | <%= link_to 'Destroy', image, :confirm => 'Are you sure?', :method => :delete %> |
<%= link_to ‘New image’, new_image_path %>
- app/models/image.rb
class Image < ActiveRecord::Base
has_and_belongs_to_many :pairs
validates_presence_of :img_file_name
has_attached_file :img, :styles => {:thumb=> “100x100#”, :page => “400x320>”}, :storage => :s3, :s3_credentials => “#{RAILS_ROOT}/config/s3.yml”
end
- config/s3.yml
bucket: (tutaj nazwa bucketu)
access_key_id: (tutaj access key id)
secret_access_key: (a tutaj oczywiscie secret access key)
W czym tkwi blad?