-
-
Notifications
You must be signed in to change notification settings - Fork 293
Chore: Apply literal properties #3102
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
Conversation
Code Climate has analyzed commit 6dc34c2 and detected 0 issues on this pull request. View more on Code Climate. |
b5f6f59
to
c94369d
Compare
0f8d440
to
35e7208
Compare
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.
I left some questions.
I noticed that we have many props with reader: :public
where the reader is not necessarily needed as public. I know this PR respects the previous attr_reader
and converts it to reader: :public
but using the instance variable is faster than accessing through the reader.
Whenever there is a case where the reader is not necessary since the attribute is used only on the object's scope lets remove the reader and use the instance variable in favor.
…tem/avo/resource_index_map_spec.rb fails
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.
I left some questions and some tweaks comments, overall is looking great, thank you for changing the readers to ivars!
app/components/avo/fields/common/files/view_type/list_item_component.rb
Outdated
Show resolved
Hide resolved
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.
Thank you for the effort on this one @binarygit!
This PR has been merged into Please check the release guide for more information. |
@binarygit @Paul-Bob this broke my custom code for setting current user based on HTTP basic auth:
module AvoCurrentUser
extend ActiveSupport::Concern
User = Struct.new(:name)
included do
before_action :set_paper_trail_whodunnit
end
protected
def user_for_paper_trail
current_user.name
end
def current_user
user, _pass = ActionController::HttpAuthentication::Basic.user_name_and_password(request)
User.new(user)
end
end
Rails.configuration.to_prepare do
Avo::ApplicationController.include AvoCurrentUser
end
|
@resource = resource | ||
end | ||
prop :field, Avo::Fields::BaseField | ||
prop :file, ActiveStorage::Attachment |
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.
This breaks eager-loading on rails apps that dont have active_storage/engine
required
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.
Thanks! We missed it before.
Fixed by #3215
This PR replaces the initialize method on components to use the
prop
method from the literal gem which provides a way to specify type.Description
Fixes #2974
Fixes #2893
Checklist:
Screenshots & recording
Manual review steps
Manual reviewer: please leave a comment with output from the test if that's the case.