| CODENOTIFIER | HelpYou are not signed inSign in |
Project: acts_as_ferret
Revision: 350
Author: jk
Date: 13 Jun 2008 06:26:38
Diff at Trac: http://projects.jkraemer.net/acts_as_ferret/changeset/350
Changes:fixing #220
Files:| ... | ...@@ -12,14 +12,12 @@ | |
| 12 | 12 | database: aaf_dev |
| 13 | 13 | username: ferret |
| 14 | 14 | password: ferret |
| 15 | socket: /var/run/mysqld/mysqld.sock | |
| 16 | 15 | |
| 17 | 16 | test: |
| 18 | 17 | adapter: mysql |
| 19 | 18 | database: aaf_test |
| 20 | 19 | username: ferret |
| 21 | 20 | password: ferret |
| 22 | socket: /var/run/mysqld/mysqld.sock | |
| 23 | 21 | |
| 24 | 22 | # since this is a demo, we won't need this one |
| 25 | 23 | #production: |
| ... | ...@@ -65,7 +65,7 @@ | |
| 65 | 65 | namespace :index do |
| 66 | 66 | |
| 67 | 67 | desc "Rebuild the Ferret index. See aaf_recipes.rb for instructions." |
| 68 | task :rebuild => :environment, :roles => :app do | |
| 68 | task :rebuild, :roles => :app do | |
| 69 | 69 | rake = fetch(:rake, 'rake') |
| 70 | 70 | rails_env = fetch(:rails_env, 'production') |
| 71 | 71 | indexes = fetch(:ferret_indexes, nil) |
| ... | ...@@ -6,8 +6,6 @@ | |
| 6 | 6 | # INDEXES="my_model shared" rake ferret:rebuild |
| 7 | 7 | desc "Rebuild a Ferret index. Specify what model to rebuild with the MODEL environment variable." |
| 8 | 8 | task :rebuild => :environment do |
| 9 | #require File.join(RAILS_ROOT, 'config', 'environment') | |
| 10 | ||
| 11 | 9 | indexes = ENV['INDEXES'].split |
| 12 | 10 | indexes.each do |index_name| |
| 13 | 11 | start = 1.minute.ago |
| ... | ...@@ -150,7 +150,8 @@ | |
| 150 | 150 | end |
| 151 | 151 | |
| 152 | 152 | def content_for_field_name(field, via = field, dynamic_boost = nil) |
| 153 | field_data = self.send(via) || self.instance_variable_get("@#{via}") | |
| 153 | field_data = (respond_to?(via) ? send(via) : instance_variable_get("@#{via}")).to_s | |
| 154 | # field_data = self.send(via) || self.instance_variable_get("@#{via}") | |
| 154 | 155 | if (dynamic_boost && boost_value = self.send(dynamic_boost)) |
| 155 | 156 | field_data = Ferret::Field.new(field_data) |
| 156 | 157 | field_data.boost = boost_value.to_i |
| ... | ...@@ -11,6 +11,15 @@ | |
| 11 | 11 | def test_truth |
| 12 | 12 | assert_kind_of Comment, comments(:first) |
| 13 | 13 | end |
| 14 | ||
| 15 | def test_issue_220_index_false_as_false | |
| 16 | c = Comment.new :content => false | |
| 17 | assert_equal false, c.content | |
| 18 | assert_equal 'false', c.content_for_field_name(:content) | |
| 19 | assert_equal 'false', c.to_doc[:content] | |
| 20 | c.save | |
| 21 | assert_equal c, Comment.find_with_ferret('content:false').first | |
| 22 | end | |
| 14 | 23 | |
| 15 | 24 | def test_if_option |
| 16 | 25 | c = Comment.new :content => 'do not index' |