kidpollo / tanker

IndexTank Integration with your fav ORM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undefined method `conditions' (Rails 3.2.12, Tanker 1.1.6)

stevegrossi opened this issue · comments

I just installed the latest tanker gem and began following the instructions in the readme, but the conditions block doesn't seem to be recognized:

undefined method `conditions' for #<Tanker::ModelConfig:0x007fdd84551270>

My model looks like this:

class Region < ActiveRecord::Base

  include Tanker

  ....

  tankit 'my_index' do
    conditions do
      indexable?
    end
    indexes :name
  end

  def indexable?
    self.name?
  end

end
commented

Did you get this resolved? I've also come across this

Unfortunately not. Including a conditions block within the tankit block as in the README still throws the error above when trying to boot Rails. My workaround has been to just add the condition to the callback:

after_save :update_tank_indexes, if: :indexable?
commented

@stevegrossi Oh, very good!