0

こんにちは私は自分のために小さなギャラリーを構築しようとしています。アルバムの複数のアップロードのためにこのリンクを試しました:http ://www.mfischer.com/wordpress/2009/02/02/multiple-image-upload-and-crop -レール付き/

これまでのところ、 localhost:3000 / albums / newにアクセスすると、次のエラーが発生します。

ArgumentError in AlbumsController#index
Unknown key(s): attributes, discard_if

attachment_fu-Pluginもpaperclip-gem(私が使用している)も正しく使用されているかどうかわからないので、それも問題になるのではないでしょうか。

さらに私のバージョン:

Ruby version    1.9.2 (x86_64-linux)
RubyGems version    1.7.1
Rack version    1.2
Rails version   3.0.4
Active Record version   3.0.4
Action Pack version 3.0.4
Active Resource version 3.0.4
Action Mailer version   3.0.4
Active Support version  3.0.4

正確なattachment_fuバージョンがわかりません...:/ペーパークリップのバージョンは次のとおりです。

paperclip (2.3.8)

My album model is this:
# == Schema Information
# Schema version: 20110404082122
#
# Table name: albums
#
#  id         :integer         not null, primary key
#  name       :string(255)
#  location   :string(255)
#  date       :date
#  created_at :datetime
#  updated_at :datetime
#

class Album < ActiveRecord::Base
  has_many  :images,
        :attributes => true,
        :discard_if => proc { |upload| upload.photo_file_size.nil? }
end

私の画像モデルは次のようになります。

# == Schema Information
# Schema version: 20110404082122
#
# Table name: images
#
#  id          :integer         not null, primary key
#  name        :string(255)
#  date        :date
#  landscape   :boolean
#  flash       :boolean
#  cameramaker :string(255)
#  cameramodel :string(255)
#  lens        :string(255)
#  flength     :string(255)
#  aperture    :string(255)
#  exposure    :string(255)
#  iso         :string(255)
#  album_id    :integer
#  filesize    :integer
#  created_at  :datetime
#  updated_at  :datetime
#

require 'RMagick'

class Image < ActiveRecord::Base
  belongs_to :album
  has_attached_file :photo,
            :styles => {
              :thumb => ["150x150", :jpg],
              :pagesize => ["500x400", :jpg],
            },
            :default_style => :pagesize
end

もっと何か必要ですか?問題が何であるかわかりません..attachment_fuプラグインが古すぎるか、レールを使用するために何かを言い逃したと思います...?

御時間ありがとうございます!

ワニエ

4

1 に答える 1

1

http://apidock.com/rails/ActiveRecord/Associations/ClassMethods/has_many

関連付けのためのオプションはありませ:attributes:discard_ifhas_many

attribute_fuそのチュートリアルの作者がプラグインを使用したように見えます。だからあなたはそれをインストールする必要があります

https://github.com/jamesgolick/attribute_fu

于 2011-04-04T10:06:52.627 に答える