Skip to content

Commit

Permalink
Reve 2
Browse files Browse the repository at this point in the history
  • Loading branch information
slash4 committed Sep 26, 2013
1 parent d48622e commit b0ee5cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/rails3-jquery-autocomplete/autocomplete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def autocomplete(object, method, options = {})
method = options[:column_name] if options.has_key?(:column_name)

term = params[:term]
site_id = 3
site_id = sessions[:wop_cur_role].site.id

if term && !term.blank?
#allow specifying fully qualified class name for model object
Expand Down
5 changes: 1 addition & 4 deletions lib/rails3-jquery-autocomplete/orm/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ def get_autocomplete_items(parameters)
items = items.select(get_autocomplete_select_clause(model, method, options)) unless options[:full_model]
items = items.where(get_autocomplete_where_clause(model, term, method, options)).
limit(limit).order(order)
puts "model #{model}"
if model = "WopEngine::Person"
puts "model person"
if model == "WopEngine::Person"
items = items.joins("join wop_roles on wop_roles.person_id=wop_people.id").where("wop_roles.site_id = ?", site_id) unless site_id.nil?
else
puts "else"
items = items.where("#{model.table_name}.site_id = ?", site_id) unless site_id.nil?
end
end
Expand Down

0 comments on commit b0ee5cf

Please sign in to comment.