Getting UnknownFileType error in Rails 3

I am getting the following error while trying to add date validation using Rails 3.

Error:

I18n::UnknownFileType (can not load translations from C:/Ruby193/lib/ruby/gems/1
.9.1/gems/date_validator-0.8.0/locales, the file type  is not known):
  app/controllers/vendors_controller.rb:26:in `create_vendor'

The following are my code file.

controller/vendors_controller.rb

class VendorsController < ApplicationController

    def create_vendor
        if params[:vendor][:s_catagory]=="Wood"
            catagory="WOODS"
        elsif params[:vendor][:s_catagory]=="Puja Samagree"
            catagory="GOODS"
        elsif params[:vendor][:s_catagory]=="Sweeper"
            catagory="SWD"
        elsif params[:vendor][:s_catagory]=="Photo Grapher"
            catagory="PHOTO"
        elsif params[:vendor][:s_catagory]=="Burning Assistant"
            catagory="BURNING"
        else
            catagory="BRAHMIN"
        end 
        @vendor= Vendor.create(:v_name => params[:vendor][:v_name],:v_address => params[:vendor][:v_address],:reg_no => params[:vendor][:reg_no],:f_name => params[:vendor][:f_name],:mob_no => params[:vendor][:mob_no],:dob => params[:vendor][:dob],:s_catagory => catagory,:dat => params[:vendor][:dat] )  
        if  @vendor && @vendor.id.present?
            @get_vendor=true
            flash[:notice]="Vendor data has submitted"
            flash[:color]="valid"
        else
            @get_err=true
        end
    end

end

vendor.rb:

class Vendor < ActiveRecord::Base
  attr_accessible :dat, :dob, :f_name, :mob_no, :reg_no, :s_catagory, :v_address, :v_name
  validates :v_name, :presence => true,:length => {:minimum => 3}
  validates :f_name, :presence => true,:length => {:minimum => 3}
  validates :mob_no, :presence => true, :length => {:in => 1..10},format: { with: /d{3}-d{3}-d{4}/, message: "bad format" }
  validates :dob,  :date => {:before => Time.now  }
  validates :s_catagory,:presence =>  true
  validates :v_address,:presence =>  true
end

Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.19'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

#gem 'mysql'
gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
gem "bcrypt-ruby", :require => "bcrypt"
# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'
gem 'momentjs-rails', '>= 2.8.1'
gem 'bootstrap3-datetimepicker-rails', '~> 4.0.0'
gem 'bootstrap-datepicker-rails', '>= 0.6.21'
#gem 'bootstrap-datepicker-rails'
gem 'will_paginate', '~> 3.0'
gem 'date_validator'  

The error is coming in vendor_controller.rb at line Vendor.create.When i click on submit button on view pagw for checking validation this type of error is coming.Please help me to resolve this error.


Source: ruby

Leave a Reply