Skip to content

Commit 6b2fee9

Browse files
Run rubocop
1 parent 91bc86e commit 6b2fee9

36 files changed

+64
-106
lines changed

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Naming/PredicateName:
7171
AllowedMethods:
7272
- has_many
7373
- has_many_actions
74+
- is_association?
7475

7576
Style/TrailingCommaInArguments:
7677
Enabled: true

activeadmin-mongoid.gemspec

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# coding: utf-8
2-
lib = File.expand_path('../lib', __FILE__)
1+
lib = File.expand_path('lib', __dir__)
32
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
43
require 'active_admin/mongoid/version'
54

@@ -10,7 +9,7 @@ Gem::Specification.new do |gem|
109
gem.summary = %q{ActiveAdmin hacks to support Mongoid}
1110
gem.homepage = ''
1211

13-
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12+
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
1413
gem.files = `git ls-files`.split("\n")
1514
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
1615
gem.name = 'activeadmin-mongoid'
@@ -24,7 +23,7 @@ Gem::Specification.new do |gem|
2423
gem.add_runtime_dependency 'activeadmin', '>= 1.4.3'
2524
gem.add_runtime_dependency 'kaminari-mongoid'
2625
gem.add_runtime_dependency 'jquery-rails'
27-
gem.add_runtime_dependency 'sass-rails', ['>= 3.1.4']
26+
gem.add_runtime_dependency 'sass-rails', ['>= 3.1.4']
2827

29-
gem.add_development_dependency 'rspec-rails', '~> 3.6'
28+
gem.add_development_dependency 'rspec-rails', '~> 3.6'
3029
end

lib/active_admin/mongoid/association/relatable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ def foreign_key
1111
return if embeds?
1212
foreign_key.to_sym rescue nil
1313
end
14-
end
14+
end

lib/active_admin/mongoid/controllers/resource_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require 'active_admin/engine'
22

33
ActiveAdmin::Engine.module_eval do
4-
54
initializer 'active_admin.mongoid.resource_controller' do
65
class ActiveAdmin::ResourceController
76
def build_new_resource

lib/active_admin/mongoid/criteria.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ def from(*a)
1919
end
2020
end
2121
end
22-

lib/active_admin/mongoid/csv_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def build(controller, csv)
1111
csv << bom if bom
1212

1313
if column_names
14-
csv << CSV.generate_line(columns.map{ |c| encode c.name, options }, csv_options)
14+
csv << CSV.generate_line(columns.map { |c| encode c.name, options }, csv_options)
1515
end
1616

1717
(1..paginated_collection.total_pages).each do |page|

lib/active_admin/mongoid/document.rb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
module ActiveAdmin::Mongoid::Document
44
extend ActiveSupport::Concern
55

6-
7-
8-
96
# PROXY CLASSES
107

118
class ColumnWrapper < SimpleDelegator
@@ -30,9 +27,6 @@ def quote_column_name name
3027
end
3128
end
3229

33-
34-
35-
3630
# CLASS METHODS
3731

3832
included do
@@ -47,7 +41,6 @@ class << self
4741
def column_for_attribute(name)
4842
self.class.fields[name.to_sym]
4943
end
50-
5144
end
5245

5346
module ClassMethods
@@ -63,7 +56,7 @@ def connection
6356
end
6457

6558
def find_by_id id
66-
find_by(:_id => id)
59+
find_by(_id: id)
6760
end
6861

6962
def quoted_table_name
@@ -74,7 +67,6 @@ def associations
7467
@associations ||= new.associations
7568
end
7669

77-
7870
def reflections *a
7971
relations *a
8072
end

lib/active_admin/mongoid/filter_form_builder.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ def filter(method, options = {})
99
def default_input_type(method, options = {})
1010
if column = column_for(method)
1111
case column.type.name.downcase.to_sym
12-
when :date, :datetime, :time; :date_range
13-
when :string, :text, :object; :string
14-
when :float, :decimal; :numeric
12+
when :date, :datetime, :time; :date_range
13+
when :string, :text, :object; :string
14+
when :float, :decimal; :numeric
1515
when :integer
16-
return :select if reflection_for(method.to_s.gsub('_id','').to_sym)
16+
return :select if reflection_for(method.to_s.gsub('_id', '').to_sym)
1717
return :numeric
1818
end
1919
elsif is_association?(method)

lib/active_admin/mongoid/filters/resource_extension.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module ActiveAdmin::Filters::ResourceExtension
44
def default_association_filters
55
if resource_class.respond_to?(:reflect_on_all_associations)
66
without_embedded = resource_class.reflect_on_all_associations.reject { |e| e.embeds? }
7-
poly, not_poly = without_embedded.partition{ |r| r.macro == :belongs_to && r.options[:polymorphic] }
7+
poly, not_poly = without_embedded.partition { |r| r.macro == :belongs_to && r.options[:polymorphic] }
88

99
filters = poly.map(&:foreign_key) + not_poly.map(&:name)
1010
filters.map &:to_sym

lib/active_admin/mongoid/resource.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Resource
66
# another. I'm not going to investigate any deeper, let's just remove the
77
# underscore prefixed fields as was the prior behavior
88
def default_filters
9-
super.reject { |filter| filter == :_id }
9+
super.reject { |filter| filter == :_id }
1010
end
1111

1212
module Attributes

0 commit comments

Comments
 (0)