berk / will_filter

rails engine plugin for filtering active_record model objects
MIT License
157 stars 76 forks source link

Unsupported data type nvarchar error #32

Open jcomplex opened 12 years ago

jcomplex commented 12 years ago

I am trying to implement will_filter in my rails app and I am getting the following error.

WillFilter::FilterException in Call_logs#index

Showing C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/will_filter-3.1.9/app/views/will_filter/filter/_conditions_footer.html.erb where line #3 raised:

[FATAL][2012-09-10 12:58:46 -0400] ActionView::Template::Error (Unsupported data type nvarchar): 1: <div class="actions"> 2: Order: 3: <%= select_tag(:wf_order, options_for_select(wf_filter.condition_options, wf_filter.order), {:onChange=>"markDirty()"}) %> 4: <%= select_tag(:wf_order_type, options_for_select(wf_filter.order_type_options, wf_filter.order_type), {:onChange=>"markDirty()"}) %> 5: Per Page: 6: <%= select_tag(:wf_per_page, options_for_select(wf_filter.per_page_options, wf_filter.per_page.to_s), {:onChange=>"markDirty()"}) %> app/views/call_logs/index.html.erb:3:in _app_views_call_logs_index_html_erb__1023601144_31561716' app/controllers/call_logs_controller.rb:9:inindex'

I followed the steps in the setup and here are my pages:

call_logs_controller.rb

def index
    @call_logs = CallLog.filter(:params => params)
    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @call_logs }
    end
  end

index.html.erb

<%= will_filter_tag(@call_logs) %>

My database is MS SQL 2008 and the majority of the column datatypes are nvarchar (xx) and here is my gemfile:

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.4.rc1)
      actionpack (= 3.2.4.rc1)
      mail (~> 2.4.4)
    actionpack (3.2.4.rc1)
      activemodel (= 3.2.4.rc1)
      activesupport (= 3.2.4.rc1)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.1)
      rack (~> 1.4.0)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.1.3)
    activemodel (3.2.4.rc1)
      activesupport (= 3.2.4.rc1)
      builder (~> 3.0.0)
    activerecord (3.2.4.rc1)
      activemodel (= 3.2.4.rc1)
      activesupport (= 3.2.4.rc1)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activerecord-sqlserver-adapter (3.2.9)
      activerecord (~> 3.2.0)
    activeresource (3.2.4.rc1)
      activemodel (= 3.2.4.rc1)
      activesupport (= 3.2.4.rc1)
    activesupport (3.2.4.rc1)
      i18n (~> 0.6)
      multi_json (~> 1.0)
    addressable (2.3.2)
    annotate (2.4.1.beta1)
    arel (3.0.2)
    bcrypt-ruby (3.0.1-x86-mingw32)
    bootstrap-sass (2.0.2)
    bootstrap-will_paginate (0.0.5)
      will_paginate
    builder (3.0.0)
    capybara (1.1.2)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      selenium-webdriver (~> 2.0)
      xpath (~> 0.1.4)
    childprocess (0.3.5)
      ffi (~> 1.0, >= 1.0.6)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.3.3)
    columnize (0.3.6)
    cucumber (1.2.1)
      builder (>= 2.1.2)
      diff-lcs (>= 1.1.3)
      gherkin (~> 2.11.0)
      json (>= 1.4.6)
    cucumber-rails (1.2.1)
      capybara (>= 1.1.2)
      cucumber (>= 1.1.3)
      nokogiri (>= 1.5.0)
    daemons (1.1.9)
    database_cleaner (0.7.0)
    debugger (1.2.0)
      columnize (>= 0.3.1)
      debugger-linecache (~> 1.1.1)
      debugger-ruby_core_source (~> 1.1.3)
    debugger-linecache (1.1.2)
      debugger-ruby_core_source (>= 1.1.1)
    debugger-ruby_core_source (1.1.3)
    diff-lcs (1.1.3)
    erubis (2.7.0)
    eventmachine (1.0.0.beta.4.1-x86-mingw32)
    exception_notification (2.6.1)
      actionmailer (>= 3.0.4)
    execjs (1.4.0)
      multi_json (~> 1.0)
    factory_girl (2.3.2)
      activesupport
    factory_girl_rails (1.4.0)
      factory_girl (~> 2.3.0)
      railties (>= 3.0.0)
    faker (1.0.1)
      i18n (~> 0.4)
    ffi (1.1.5)
    gherkin (2.11.1-x86-mingw32)
      json (>= 1.4.6)
    guard (1.3.2)
      listen (>= 0.4.2)
      thor (>= 0.14.6)
    guard-rspec (0.5.5)
      guard (>= 0.8.4)
    guard-spork (0.3.2)
      guard (>= 0.8.4)
      spork (>= 0.8.4)
    hike (1.2.1)
    i18n (0.6.0)
    journey (1.0.4)
    jquery-rails (2.0.2)
      railties (>= 3.2.0, < 5.0)
      thor (~> 0.14)
    json (1.7.4)
    kaminari (0.14.0)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    launchy (2.1.2)
      addressable (~> 2.3)
    letter_opener (0.0.2)
      launchy
    libwebsocket (0.1.5)
      addressable
    listen (0.4.7)
      rb-fchange (~> 0.0.5)
      rb-fsevent (~> 0.9.1)
      rb-inotify (~> 0.8.8)
    mail (2.4.4)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.19)
    multi_json (1.3.6)
    nokogiri (1.5.5-x86-mingw32)
    polyglot (0.3.3)
    quiet_assets (1.0.1)
      railties (~> 3.1)
    rack (1.4.1)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.2)
      rack
    rack-test (0.6.1)
      rack (>= 1.0)
    rails (3.2.4.rc1)
      actionmailer (= 3.2.4.rc1)
      actionpack (= 3.2.4.rc1)
      activerecord (= 3.2.4.rc1)
      activeresource (= 3.2.4.rc1)
      activesupport (= 3.2.4.rc1)
      bundler (~> 1.0)
      railties (= 3.2.4.rc1)
    railties (3.2.4.rc1)
      actionpack (= 3.2.4.rc1)
      activesupport (= 3.2.4.rc1)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (0.9.2.2)
    rb-fchange (0.0.5)
      ffi
    rb-fsevent (0.9.1)
    rb-inotify (0.8.8)
      ffi (>= 0.5.0)
    rb-notifu (0.0.4)
    rdoc (3.12)
      json (~> 1.4)
    rspec (2.10.0)
      rspec-core (~> 2.10.0)
      rspec-expectations (~> 2.10.0)
      rspec-mocks (~> 2.10.0)
    rspec-core (2.10.1)
    rspec-expectations (2.10.0)
      diff-lcs (~> 1.1.3)
    rspec-mocks (2.10.1)
    rspec-rails (2.10.0)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec (~> 2.10.0)
    rubyzip (0.9.9)
    sass (3.2.1)
    sass-rails (3.2.4)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    selenium-webdriver (2.25.0)
      childprocess (>= 0.2.5)
      libwebsocket (~> 0.1.3)
      multi_json (~> 1.0)
      rubyzip
    spork (0.9.0-x86-mingw32)
      win32-process
    sprockets (2.1.3)
      hike (~> 1.2)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    thin (1.4.1)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)
    thor (0.16.0)
    tilt (1.3.3)
    tiny_tds (0.5.1-x86-mingw32)
    treetop (1.4.10)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.33)
    uglifier (1.2.3)
      execjs (>= 0.3.0)
      multi_json (>= 1.0.2)
    will_filter (3.1.9)
      kaminari
      rails (>= 3.2.3)
      sass
    will_paginate (3.0.3)
    win32-api (1.4.8-x86-mingw32)
    win32-process (0.6.6)
      windows-pr (>= 1.2.2)
    win32console (1.3.0-x86-mingw32)
    windows-api (0.4.2)
      win32-api (>= 1.4.5)
    windows-pr (1.2.2)
      win32-api (>= 1.4.5)
      windows-api (>= 0.3.0)
    xpath (0.1.4)
      nokogiri (~> 1.3)

PLATFORMS
  x86-mingw32

DEPENDENCIES
  activerecord-sqlserver-adapter
  annotate (~> 2.4.1.beta)
  bcrypt-ruby (= 3.0.1)
  bootstrap-sass (= 2.0.2)
  bootstrap-will_paginate (= 0.0.5)
  capybara (= 1.1.2)
  coffee-rails (= 3.2.2)
  cucumber-rails (= 1.2.1)
  database_cleaner (= 0.7.0)
  debugger
  eventmachine (= 1.0.0.beta.4.1)
  exception_notification
  factory_girl_rails (= 1.4.0)
  faker (= 1.0.1)
  guard-rspec (= 0.5.5)
  guard-spork (= 0.3.2)
  jquery-rails
  kaminari
  letter_opener
  quiet_assets
  rails (= 3.2.4.rc1)
  rb-fchange (= 0.0.5)
  rb-notifu (= 0.0.4)
  rspec-rails (= 2.10.0)
  sass-rails (= 3.2.4)
  spork (= 0.9.0)
  thin
  tiny_tds
  uglifier (= 1.2.3)
  will_filter (~> 3.1.0)
  win32console (= 1.3.0)

Any help would be great.

RyanMacG commented 11 years ago

I'm also running into this, is MSSQL unsupported in will_filter?

mbandrewfoster commented 11 years ago

Open up the config/will_filter/config.yml

Add this under data_types: nvarchar: [nil, text, text_delimited]

I also had to add the following, you may or may not need that also bit: [nil, boolean]

I'm using MSSQL also.