Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 使用carrierwave上载多列版本_Ruby On Rails_Ruby_Carrierwave - Fatal编程技术网

Ruby on rails 使用carrierwave上载多列版本

Ruby on rails 使用carrierwave上载多列版本,ruby-on-rails,ruby,carrierwave,Ruby On Rails,Ruby,Carrierwave,我使用rails4开发,并使用carrierwave上传图像文件 我在myModel中添加了一个列来上传另一个图像列 class MyModel < ActiveRecord::Base mount_uploader :image, ImageUploader ANDROID = {:image => [800, 355]} IPHONE = {:image => [800, 355]} THUMBNAIL = {:image => [

我使用rails4开发,并使用carrierwave上传图像文件

我在myModel中添加了一个列来上传另一个图像列

class MyModel  < ActiveRecord::Base

    mount_uploader :image, ImageUploader
    ANDROID = {:image => [800, 355]}
    IPHONE = {:image => [800, 355]}
    THUMBNAIL = {:image => [150, 150]}

    mount_uploader :square_image, ImageUploader
    ANDROID = {:square_image => [800, 800]}
    IPHONE = {:square_image => [800, 800]}
    THUMBNAIL = {:square_image => [150, 150]}
end
我不知道我在干什么


帮帮我~。

您正在为不同的图像定义相同的常量,因此会收到这样的警告。请确保您使用的常量对于不同的图像是不同的images@anusha不接受使用相同的常量吗?如果可能的话,你能解释一下我是怎么做的吗?是的,因为我们不能多次设置常量,所以为square\u image字段定义另外3个不同的常量,比如ANDROID\u square={:square\u image=>[800800]}IPHONE\u square={:square\u image=>[150150]}使用这些变量,无论您在方形图像和ofr法线图像中使用什么,请使用您定义的常量earlier@anusha好的!!!!Thx to advice~:让我知道它是否有效
 warning: already initialized constant MyModel::ANDROID
 DEBUG[c0668d68]    app/models/my_model.rb:LINE_NUMBER: warning: previous definition of ANDROID was here