Skip to content
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

Remove monkey-patching #231

Closed
artur-intech opened this issue Oct 31, 2016 · 24 comments
Closed

Remove monkey-patching #231

artur-intech opened this issue Oct 31, 2016 · 24 comments
Assignees

Comments

@artur-intech
Copy link
Contributor

artur-intech commented Oct 31, 2016

config/initializers/eis_custom_active_model.rb
config/initializers/eis_custom_active_record.rb
config/initializers/eis_custom_flash.rb

@artur-intech artur-intech changed the title Consider removing monkey-patching Remove monkey-patching Apr 6, 2017
@artur-intech
Copy link
Contributor Author

@ratM1n @teadur What is point of config/initializers/eis_custom_flash.rb?

@teadur
Copy link
Contributor

teadur commented Apr 6, 2017

@artur-intech
Copy link
Contributor Author

artur-intech commented Apr 7, 2017

What is the reason of monkey-patching the class we don't own? (i.e. the point of having this file, since it is not needed by Rails)

@teadur
Copy link
Contributor

teadur commented Apr 9, 2017

It logs all the flash messages to syslog/standard logger

@artur-intech
Copy link
Contributor Author

artur-intech commented Apr 9, 2017

I was actually wondering why that code is present there. If nobody knows the reason, I am about to remove first 3. The latter requires code base change.

@teadur
Copy link
Contributor

teadur commented Apr 9, 2017

They all give some extra logging, i wouldnt remove them just yet.
I think it would make sense to look at logs first and see what value they give to us.
Havent looked at active model/record yet, but flash could be beneficial at some cases.

@artur-intech
Copy link
Contributor Author

artur-intech commented Apr 9, 2017

First of all, I am trying to say that monkey patching is very dangerous. There should be unbeatable argument to do it, and currently there is no.
Secondly, I don't understand why do you want to log flash messages? These are the messages that are persisted in session until next request to show them to the user. Please explain me.

@artur-intech
Copy link
Contributor Author

artur-intech commented Apr 27, 2017

Example of real-life WTF http://prntscr.com/f1foaz

artur-intech pushed a commit that referenced this issue Aug 4, 2017
This was referenced Aug 4, 2017
@artur-intech
Copy link
Contributor Author

artur-intech commented Aug 4, 2017

Nothing to test. Should not affect any production code.

@vohmar
Copy link
Contributor

vohmar commented Sep 1, 2017

@teadur Is this good by you?

@vohmar vohmar assigned teadur and unassigned vohmar Sep 1, 2017
@teadur
Copy link
Contributor

teadur commented Sep 15, 2017

@artur-beljajev why is http://prntscr.com/f1foaz a problem ?
Rather then showing just valid false it shows all the problems with the validation, why is that a problem ?
Or how would you find out the actual problems if the errors arent shown ?
Or how would the behviour in the screenshot change when we remove what we have suggested ?

@artur-intech
Copy link
Contributor Author

artur-intech commented Sep 17, 2017

It is unnecessary. active_model_object.errors.full_messages returns what you want.

@teadur
Copy link
Contributor

teadur commented Sep 18, 2017

I think its far easier to use valid? then this long reference to get the error, what is the actual problem with it, does it brake anything ?

@artur-intech
Copy link
Contributor Author

Why do you need that error at all?

@teadur
Copy link
Contributor

teadur commented Sep 18, 2017

Its really convient when you want to know why some objects validation failed, sadly you cant check object state from any UI you need to use the actual rails console for it.

@artur-intech
Copy link
Contributor Author

artur-intech commented Dec 21, 2017

This ticket cannot be closed until config/initializers/eis_custom_active_record.rb is removed.

#231 (comment) remains valid. It creates unnecessary noise with no benefit.

@teadur
9293d09 If you mean model errors, then it is only possible in admin (since other areas use EPP) so there no model objects available. If you're ok with this, I might add errors to UI with #580.

@vohmar vohmar closed this as completed Jan 26, 2018
@artur-intech artur-intech reopened this Feb 6, 2018
@artur-intech
Copy link
Contributor Author

@vohmar Any reason why this issue has been closed?

The code is still there

Rails.logger.info "USER MSG: ACTIVERECORD: #{m.class} ##{m.id} #{m.errors.full_messages} #{m.errors['epp_errors']}" if m.errors.present?

@artur-intech artur-intech assigned vohmar and unassigned teadur Feb 6, 2018
@artur-intech
Copy link
Contributor Author

artur-intech commented Feb 6, 2018

I might also set config.log_level to some higher level to hide all that noise, but I think it opens a possibility that I miss something I need.

@artur-intech
Copy link
Contributor Author

The information in question may be obtained using active_model_object.errors.full_messages

@artur-intech
Copy link
Contributor Author

That monkey-patch can lead to problems with Rails update in the future.

@vohmar
Copy link
Contributor

vohmar commented Feb 8, 2018

I must have misunderstood that work with config/initializers/eis_custom_active_model.rb, eis_custom_active_record.rb and eis_custom_flash.rb is done.

@artur-intech
Copy link
Contributor Author

eis_custom_active_model.rb and eis_custom_flash.rb have been removed, that's perfect!
eis_custom_active_record.rb is the only thing in question.

How is that logging in the latter is useful for us?

@teadur
Copy link
Contributor

teadur commented Mar 22, 2018

It's useful when you look at logs, if you think its so big problem and brakes everything remove it.

@vohmar
Copy link
Contributor

vohmar commented Apr 23, 2018

in production

@vohmar vohmar closed this as completed Apr 23, 2018
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

No branches or pull requests

3 participants