title: why 'method missing' error in ROR?
body: <p>Despite the other excellent answers here to similar posts, I cannot see the error in my code that is producing this error: "undefined method `parse_file' for..." 
  I'm using RoR (Rails 2.1) and am simply trying to upload and parse a csv file using FasterCSV plugin. I am also saving a record of the file's filename in the Upload table.</p>
  
  <p>Many thanks for any help (this is driving me nuts...):</p>
  
  <p>my model:</p>
  
  <pre><code>   require 'fastercsv'
  
    def new
  
      @upload = Upload.new
  
    end
  
    def self.parse_file(file)    
  
      FasterCSV.foreach(file.path,:headers=&gt;"first_row", :col_sep=&gt;"\t") do |row|
        row.each{|row| puts "row: #{row.inspect}"}
      end
  
    end
  </code></pre>
  
  <p>my controller:</p>
  
  <pre><code> def create
  
      @upload = Upload.new    
      thefile = params[:upload][:upload_file]
      @upload.filename = base_part_of(thefile.original_filename)
      @upload.parse_file(thefile)
  
      respond_to do |format|
        if @upload.save
          flash[:notice] = 'Upload was successful.'
          format.html { redirect_to(@upload) }
          format.xml  { render :xml =&gt; @upload, :status =&gt; :created, :location =&gt; @upload }
        else
          format.html { render :action =&gt; "new" }
          format.xml  { render :xml =&gt; @upload.errors, :status =&gt; :unprocessable_entity }
        end
      end
  
    end
  
  
    def base_part_of(file_name)
        File.basename(file_name)
    end
  </code></pre>
  
  <p>my view:</p>
  
  <pre><code>&lt;% form_for(:upload,
               :url =&gt; {:action=&gt; :create},
               :html =&gt; { :multipart =&gt; true} ) do |form| %&gt;
  
    Upload your file: &lt;%= form.file_field("upload_file",:size=&gt;50,:class =&gt; "csv-input") %&gt;&lt;br/&gt;
  
    &lt;%= submit_tag("Upload") %&gt;
  
  &lt;% end %&gt;
  </code></pre>
  
  <p>the (partial) stack trace of the error:</p>
  
  <pre><code>vendor/rails/activerecord/lib/active_record/attribute_methods.rb:256:in `method_missing'
  vendor/rails/actionpack/lib/action_controller/base.rb:1162:in `send'
  vendor/rails/actionpack/lib/action_controller/base.rb:1162:in `perform_action_without_filters'
  vendor/rails/actionpack/lib/action_controller/filters.rb:580:in `call_filters'
  vendor/rails/actionpack/lib/action_controller/filters.rb:573:in `perform_action_without_benchmark'
  vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
  /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
  vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
  vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
  vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
  vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
  vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
  vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
  vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'
  vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters'
  vendor/rails/actionpack/lib/action_controller/filters.rb:569:in `process_without_session_management_support'
  vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `process'
  vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process'
  ...
  </code></pre>