Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced filter: uninitialized constant Wf #14

Closed
tonymarschall opened this issue Apr 14, 2012 · 8 comments
Closed

Advanced filter: uninitialized constant Wf #14

tonymarschall opened this issue Apr 14, 2012 · 8 comments

Comments

@tonymarschall
Copy link

I try to use will_filter with a custom filter (like in will_filter_example) but get error "uninitialized constant Wf".

My setup:

# controller index
Task.filter(:params => params, :filter => :timeentry_filter)

# filter under /app/models/filter/task_filter.rb
class TaskFilter < Wf::Filter
...
end

# application.rb
config.autoload_paths += Dir[Rails.root.join('app', 'models', '{**}')]

Like described in readme i have setup will_filter in my Gemfile. Seems like will_filter_example will_filter is setup as plugin. Are there more setup steps necessary?

Sorry for spamming your issue queue...

@tonymarschall
Copy link
Author

Seems like WF is now WillFilter. Its working with class TaskFilter < WillFilter::Filter

@bhushangahire
Copy link

Same issue with me. Its not working for me with Rails 3.1.3. Is there anything else you did?

@tonymarschall
Copy link
Author

Its working for me on Rails 3.2.3 with this setup:

# app/controllers/user_controller.rb
class UsersController < ApplicationController
  def index
    @users = User.filter(:params => params, :filter => :user_filter)
...

# app/models/filters/user_filter.rb
class UserFilter < WillFilter::Filter
  def model_class
    User
  end
...

# app/views/user/index.html.erb
<%= will_filter_tag(@users) %>
<%= will_filter_table_tag(@users) %>

# config/application.rb
config.autoload_paths += Dir[Rails.root.join('app', 'models', '{**}')]

# Gemfile
gem 'will_filter', "~> 3.1.0" 
gem 'kaminari'

@bhushangahire
Copy link

Still not working for me with above setup can you post your Gemfile settings as well.

@tonymarschall
Copy link
Author

Added my gemfile settings to previous comment.

The base setup is like in readme:

# Add the following gems to your Gemfile:
gem 'will_filter', "~> 3.1.0" 
gem 'kaminari'
# And run:
$ bundle
# To configure and initialize will_filter engine, run the following commands:
$ rails generate will_filter  
$ rake db:migrate
# At the top of your routes.rb file, add the following line:
mount WillFilter::Engine => "/will_filter"

@bhushangahire
Copy link

Ok thanks, I think its breaking because of some other gem. I created it
with new application and its working fine, but not with my application.

I am getting below error.

RuntimeError in Will_filter/filter#index

Showing /usr/share/ruby-rvm/gems/ruby-1.9.2-p290@wgs_rails3/gems/will_filter-3.1.6/app/views/will_filter/filter/_conditions_header.html.erb
where line #2 raised:

Called id for nil, which would mistakenly be 4 -- if you really wanted the
id of nil, use object_id

Extracted source (around line #2):

1:


2: <%= hidden_field_tag(:wf_id, wf_filter.id) %>
3: <%= hidden_field_tag(:wf_type, wf_filter.class.name) %>
4: <%= hidden_field_tag(:wf_dirty, "false") %>
5: <%= hidden_field_tag(:wf_submitted, "false") %>

On Tue, Apr 17, 2012 at 5:56 PM, Tony Marschall <
reply@reply.github.com

wrote:

Added my gemfile settings to previous comment.

The base setup is like in readme:

Add the following gems to your Gemfile:

gem 'will_filter', "~> 3.1.0"
gem 'kaminari'

And run:

$ bundle

To configure and initialize will_filter engine, run the following

commands:
$ rails generate will_filter
$ rake db:migrate

At the top of your routes.rb file, add the following line:

mount WillFilter::Engine => "/will_filter"


Reply to this email directly or view it on GitHub:
#14 (comment)

Bhushan Ahire
mob : +91 9619197963
email: *bhushangahire2007@gmail.com * bhushangahire2007@gmail.com
Twitter: bhushangahire http://www.twitter.com/bhushangahire
www.bhushangahire.net
www.dhulecity.info

@ebeweber
Copy link

@bhushangahire: Did you ever figure anything out? I have recently come across an error almost identical to the one described.

@bhushangahire
Copy link

I dont remember right now. But I think some other gem is causing this issue. I also created my fork with some dynamic changes and I am using same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants