22

我有 Rails 3

载波 0.5.4

//app/uploaders/fasta_uploader.rb

class FastaUploader < CarrierWave::Uploader::Base
  storage :file
  def store_dir
      'public/data/01_fasta'
  end
end

//移民

class AddFileUpToCvits < ActiveRecord::Migration
  def self.up
    add_column :cvits, :fasta, :string
  end

  def self.down
    remove_column :cvits, :fasta
  end
end

//app/models/cvit.rb

class Cvit < ActiveRecord::Base
    attr_accessible :fasta
    mount_uploader :fasta, FastaUploader
end

//形式

<%= form_for(@cvit, :html => {:multipart => true, :onsubmit => "return ray.ajax()" }) do |f| %>
  ...
  ...
  <%= f.file_field :fasta %><br></br>
  <div class="actions">
    <%= f.submit "Submit"%>
  </div>
<% end %>

我收到此错误:未初始化的常量 Cvit::FastUploader

有什么建议么???

4

1 回答 1

64

一个简单的服务器重置解决了这个问题 -_- 你生活,你学习。

于 2011-07-07T18:27:13.890 回答