Skip to content

Conversation

@paul-at
Copy link

@paul-at paul-at commented Jun 28, 2017

Supports autocompletion search by several fields/methods at a time.

ActiveRecord only


def param_to_array(s)
return s if s.kind_of?(Array)
return [s]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant return detected.

end

def param_to_array(s)
return s if s.kind_of?(Array)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer Object#is_a? over Object#kind_of?.

model.connection.class.to_s.match(/PostgreSQLAdapter/)
end

def param_to_array(s)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected.

table_name = model.table_name
(["#{table_name}.#{model.primary_key}", "#{table_name}.#{method}"] + (options[:extra_data].blank? ? [] : options[:extra_data]))
l = ["#{table_name}.#{model.primary_key}"]
param_to_array(method).each do |method|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shadowing outer local variable - method.

order << active_record_get_autocomplete_order(method, options, model)
end

items = items.where(clauses.join(' OR '), *conditions).limit(limit).order(order.join(', '))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Line is too long. [99/80]


clauses = []
conditions = []
param_to_array(method).each do |method|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shadowing outer local variable - method.

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

Successfully merging this pull request may close these issues.

2 participants