我試圖在我的rails應用程序中使用回形針設置Amazon S3存儲。Rails:AWS S3 + Paperclip:在AssetsController中獲取NoMethodError#create
我有一個名爲「資產」的模式,屬於「用戶」
這裏是第幾行中Asset.rb
attr_accessible :user_id, :uploaded_file
belongs_to :user
#set up "uploaded_file" filed as attached_file(using paperclip)
has_attached_file :uploaded_file,
:path => "assets/:id/:basename.:extension",
:storage => :s3,
:s3_credentials => "#{Rails.root}/config/amazon_s3.yml",
:bucket => "XXXXX"
validates_attachment_size :uploaded_file, :less_than => 1000.megabytes
validates_attachment_presence :uploaded_file
即時得到一個錯誤,當我加載視圖:
NoMethodError in AssetsController#create
undefined method `symbolize_keys' for #<String:0x00000103939258>
這是什麼意思。它與「Asset.rb」 :s3_credentials =>「#{Rails.root} /config/amazon_s3.yml」中的這一行有關,
我擡頭看了一下網絡, Rails_ROOT如何被棄用,所以我使用了Rails.root。仍然收到此錯誤。
此外,我還將AWS密鑰和密碼保存在amazon_s3.yml配置文件中。
這不是最好的做法,所以如果任何人有任何其他想法,我很樂意聽到他們。 heroku在他們的網站上稱變量爲環境變量,但是,我不知道我將如何在heroku上設置它,以及在我的本地開發計算機上如何處理Im?這將如何工作?
我只是有點困惑,所以看看是否有一個完整的例子或教程在那裏。所有我能找到被拋棄了設置.....
感謝
什麼回溯/地方,你調用創建看起來像? –