title: Ruby parse CSV file to print out the rows
body: <p>I have a file upload in my Rails application and I want to parse the CSV file assuming the upload went okay. You can see the comment below that indicates where I would like to read the rows of the CSV file. How can I do this? I used carrierwave for the file upload.</p>
  
  <p>I mounted it as such</p>
  
  <pre><code>mount_uploader :file, LCFileUploader
  </code></pre>
  
  <p>Here is the code I currently have</p>
  
  <pre><code>require 'CSV'
  class LCFilesController &lt; ApplicationController
      def new
          authorize! :create, :lc_file
          @lc_file = LCFile.new
      end
  
      def create
          authorize! :create, :lc_file
          puts params
          @lc_file = LCFile.new(params[:lc_file])
          @lc_file.user_id = current_user.id
          if @lc_file.save
  
              #PARSE CSV HERE TO PRINT OUT THE ROWS OF THE CSV FILE
              CSV.foreach(@lc_file.file.path) do |row|
                  puts row
              end
  
              redirect_to lc_path, :notice =&gt; 'New lc created!'
          else
              render :new
          end
      end
  end
  </code></pre>
  
  <p>and I get this error:</p>
  
  <pre><code>undefined method `find_all_by_team_id' for #&lt;Class:0x007fe14c40d848&gt;
  </code></pre>