Skip to content

Commit f567014

Browse files
committed
rubocop autocorrect
1 parent 411a287 commit f567014

16 files changed

+45
-47
lines changed

Gemfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ gem "redis", ">= 4.0.1"
3939
# gem "bcrypt", "~> 3.1.7"
4040

4141
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
42-
gem "tzinfo-data", platforms: %i[ windows jruby ]
42+
gem "tzinfo-data", platforms: %i[windows jruby]
4343

4444
# Reduces boot times through caching; required in config/boot.rb
4545
gem "bootsnap", require: false
@@ -50,10 +50,9 @@ gem "bootsnap", require: false
5050
gem "simple_form", "~> 5.3"
5151
gem "devise", "~> 4.9"
5252

53-
5453
group :development, :test do
5554
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
56-
gem "debug", platforms: %i[ mri windows ]
55+
gem "debug", platforms: %i[mri windows]
5756
gem "dotenv", "~> 3.1"
5857

5958
gem "rubocop"

app/controllers/line_item_dates_controller.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ def update
3636
end
3737

3838
def destroy
39-
@line_item_date.destroy
39+
@line_item_date.destroy
4040

41-
respond_to do |format|
42-
notice = "Date was successfully destroyed."
43-
format.html { redirect_to quote_path(@quote), notice: }
44-
format.turbo_stream { flash.now[:notice] = notice }
41+
respond_to do |format|
42+
notice = "Date was successfully destroyed."
43+
format.html { redirect_to quote_path(@quote), notice: }
44+
format.turbo_stream { flash.now[:notice] = notice }
45+
end
4546
end
46-
end
4747

4848
private
4949

app/controllers/line_items_controller.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ def update
3939
def destroy
4040
@line_item.destroy
4141

42-
respond_to do |format|
43-
notice = "Date was successfully destroyed."
44-
format.html { redirect_to quote_path(@quote), notice: }
45-
format.turbo_stream { flash.now[:notice] = notice }
46-
end
42+
respond_to do |format|
43+
notice = "Date was successfully destroyed."
44+
format.html { redirect_to quote_path(@quote), notice: }
45+
format.turbo_stream { flash.now[:notice] = notice }
46+
end
4747
end
4848

4949
private

app/controllers/quotes_controller.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ def create
1919
@quote = current_company.quotes.build(quote_params)
2020

2121
if @quote.save
22-
respond_to do |format|
23-
notice = "Quote was successfully created."
24-
format.html { redirect_to quotes_path, notice: }
25-
format.turbo_stream { flash.now[:notice] = notice }
22+
respond_to do |format|
23+
notice = "Quote was successfully created."
24+
format.html { redirect_to quotes_path, notice: }
25+
format.turbo_stream { flash.now[:notice] = notice }
26+
end
27+
else
28+
render :new, status: :unprocessable_entity
2629
end
27-
else
28-
render :new, status: :unprocessable_entity
29-
end
3030
end
3131

3232
def edit

app/models/line_item.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ class LineItem < ApplicationRecord
22
belongs_to :line_item_date
33

44
validates :name, presence: true
5-
validates :quantity, presence: true, numericality: { only_integer: true, greater_than: 0 }
6-
validates :unit_price, presence: true, numericality: { greater_than: 0 }
5+
validates :quantity, presence: true, numericality: {only_integer: true, greater_than: 0}
6+
validates :unit_price, presence: true, numericality: {greater_than: 0}
77

88
delegate :quote, to: :line_item_date
99

app/models/line_item_date.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
class LineItemDate < ApplicationRecord
22
belongs_to :quote
3-
has_many :line_items, dependent: :destroy #, strict_loading: true
3+
has_many :line_items, dependent: :destroy # TODO:, strict_loading: true
44

5-
validates :date, presence: true, uniqueness: { scope: :quote_id }
5+
validates :date, presence: true, uniqueness: {scope: :quote_id}
66

77
scope :ordered, -> { order(date: :asc) }
88

99
def previous_date
10-
quote.line_item_dates.ordered.where("date < ?", date).last
10+
quote.line_item_dates.ordered.where(date: ...date).last
1111
end
1212
end

app/models/quote.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Quote < ApplicationRecord
22
belongs_to :company
3-
has_many :line_item_dates, dependent: :destroy #, strict_loading: true
3+
has_many :line_item_dates, dependent: :destroy # TODO, strict_loading: true
44
has_many :line_items, through: :line_item_dates
55

66
validates :name, presence: true

config/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Application < Rails::Application
1414
# Please, add to the `ignore` list any other `lib` subdirectories that do
1515
# not contain `.rb` files, or that should not be reloaded or eager loaded.
1616
# Common ones are `templates`, `generators`, or `middleware`, for example.
17-
config.autoload_lib(ignore: %w(assets tasks))
17+
config.autoload_lib(ignore: %w[assets tasks])
1818

1919
# Configuration for the application, engines, and railties goes here.
2020
#

config/environments/production.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@
5252
config.force_ssl = true
5353

5454
# Log to STDOUT by default
55-
config.logger = ActiveSupport::Logger.new(STDOUT)
56-
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
55+
config.logger = ActiveSupport::Logger.new($stdout)
56+
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
5757
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
5858

5959
# Prepend all log lines with the following tags.
60-
config.log_tags = [ :request_id ]
60+
config.log_tags = [:request_id]
6161

6262
# "info" includes generic and useful information about system operation, but avoids logging too much
6363
# information to avoid inadvertent exposure of personally identifiable information (PII). If you

config/initializers/devise.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# Configure the e-mail address which will be shown in Devise::Mailer,
2525
# note that it will be overwritten if you use your own mailer class
2626
# with default "from" parameter.
27-
config.mailer_sender = '[email protected]'
27+
config.mailer_sender = "[email protected]"
2828

2929
# Configure the class responsible to send e-mails.
3030
# config.mailer = 'Devise::Mailer'
@@ -36,7 +36,7 @@
3636
# Load and configure the ORM. Supports :active_record (default) and
3737
# :mongoid (bson_ext recommended) by default. Other ORMs may be
3838
# available as additional gems.
39-
require 'devise/orm/active_record'
39+
require "devise/orm/active_record"
4040

4141
# ==> Configuration for any authentication mechanism
4242
# Configure which keys are used when authenticating a user. The default is

0 commit comments

Comments
 (0)