Validations for Importing CSV data into MySql database in Rails 3.1?

i implemented the task of importing data from csv into MySQL database
successfully. Now, my requirement is: i need to get error message with
line number, if there is any mis match of data in csv file while

This is my controller code:

require 'csv' #at the top and followed by...
def load_csv
# no code

def import_csv
parsed_file = CSV.foreach(params[:csv].tempfile,:headers => true) do


row = row.to_hash.with_indifferent_access
redirect_to :action => :index

In my view/ load_csv.html.erb:

<%= form_for(:institute, :url => import_csv_institutes_path, :html =>
{:multipart => true}) do |f| %>
<div class="field">
<%= file_field_tag :csv %>
<%= f.submit 'Import' %>
<% end %>

In config/route.rb:
  resources :institutes do
    get 'load_csv', :on => :collection
    post 'import_csv', :on => :collection

I tried for flash message before redirect_to :action => :index in
import_csv, but its of no use.. TH eflash is not working.
The above are the only three steps i used for importing. Model
validations are working only for form and for csv, an error page
displayed.. Please try to help me out.........................