-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: rails 4 Flash fixes #55
Conversation
class ApplicationController < ActionController::Base; end | ||
|
||
describe ApplicationController, type: :controller do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at block body beginning.
env[KEY] = flash_hash.dup | ||
end | ||
|
||
if (!session.respond_to?(:loaded?) || session.loaded?) && # (reset_session uses {}, which doesn't implement #loaded?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [123/120]
@app = app | ||
end | ||
|
||
def call(env) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cyclomatic complexity for call is too high. [9/6]
Perceived complexity for call is too high. [9/7]
|
||
def stringify_array(array) | ||
array.map do |item| | ||
item.kind_of?(Symbol) ? item.to_s : item |
There was a problem hiding this comment.
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?.
self[:notice] = message | ||
end | ||
|
||
protected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep a blank line before and after protected.
@flashes.each(&block) | ||
end | ||
|
||
alias :merge! :update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use alias merge! update instead of alias :merge! :update.
flash = case value | ||
when FlashHash # Rails 3.1, 3.2 | ||
new(value.instance_variable_get(:@flashes), value.instance_variable_get(:@used)) | ||
when Hash # Rails 4.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent when as deep as case.
|
||
def self.from_session_value(value) | ||
flash = case value | ||
when FlashHash # Rails 3.1, 3.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent when as deep as case.
k = k.to_s | ||
@flash[k] = v | ||
@flash.discard(k) | ||
v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable v used in void context.
|
||
# The flash provides a way to pass temporary objects between actions. Anything you place in the flash will be exposed | ||
# to the very next action and then cleared out. This is a great way of doing notices and alerts, such as a create | ||
# action that sets <tt>flash[:notice] = "Post successfully created"</tt> before redirecting to a display action that can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [122/120]
lib/apress/utils/version.rb
Outdated
@@ -1,5 +1,5 @@ | |||
module Apress | |||
module Utils | |||
VERSION = '2.5.0'.freeze | |||
VERSION = '2.6.0'.freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Горячка я считаю, в прод не вышло, а патч огромный
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ну ок, патч просто работает только в рельсах >= 4
aafc43c
to
21f3cf8
Compare
поменял ветку 🆙 |
@abak-press/apress-utils-owners |
В рельсах 4.0/4.1 есть проблемы с флешем - пишем символы, читаем строки и тп.
rails/rails#13945
взял версию класса Flash от 4.2, фиксы:
rails/rails@a6ce984
rails/rails@a668bef
rails/rails@3c60fb4