2011-11-28 117 views
0

我是RAILS的初學者。Rails結構文件夾

我寫了一些代碼,驗證我是否加載CVS是正確

我也有一個控制器的員工(在這個控制器我會把驗證):

def import 
    if params[:csv_file] 
    Employee.import_from_csv(params[:csv_file], @organization, current_user) 
    redirect_to admin_organization_employees_path(@organization), :notice => "Your request has been accepted! We will inform you via email about the results!" 
    else 
    redirect_to :back, :notice => "Missing file" 
    end 
end 

在這地方,我應該把類CSV_Validator有很多代碼?在Lib中如何使用它?

回答

2

在你的模型中。

正如經驗法則,將大部分代碼放在模型中。

Rails doc