Skip to content

Commit

Permalink
fixed bug where an unselected belongs-to association in a search woul…
Browse files Browse the repository at this point in the history
…d end up searching for a foreign key of 0
  • Loading branch information
fhwang committed May 1, 2009
1 parent 8bc38c1 commit 98a90b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/admin_assistant/column.rb
Expand Up @@ -114,7 +114,7 @@ def add_to_query_condition(ar_query_condition)
sub_cond.bind_vars << "%#{@search_terms}%"
end
end
elsif
elsif @search_terms.to_i != 0
ar_query_condition.sqls << "#{association_foreign_key} = ?"
ar_query_condition.bind_vars << @search_terms
end
Expand Down
Expand Up @@ -289,7 +289,8 @@
get(
:index,
:search => {
:body => "", :title => "foobar", :textile => "", :id => ""
:body => "", :title => "foobar", :textile => "", :id => "",
:user => ''
}
)
response.should be_success
Expand Down Expand Up @@ -320,7 +321,8 @@
get(
:index,
:search => {
:textile => 'false', :title => 'foobar', '(all_or_any)' => 'all'
:textile => 'false', :title => 'foobar', '(all_or_any)' => 'all',
:user => ''
}
)
response.should be_success
Expand Down Expand Up @@ -359,7 +361,8 @@
get(
:index,
:search => {
:textile => 'false', :title => 'foobar', '(all_or_any)' => 'any'
:textile => 'false', :title => 'foobar', '(all_or_any)' => 'any',
:user => ''
}
)
response.should be_success
Expand Down

0 comments on commit 98a90b7

Please sign in to comment.