-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Refactor error message in _edit_form.html.erb, partial fix for #8545 #8553
Refactor error message in _edit_form.html.erb, partial fix for #8545 #8553
Conversation
Codecov Report
@@ Coverage Diff @@
## main #8553 +/- ##
==========================================
- Coverage 81.91% 81.88% -0.04%
==========================================
Files 101 101
Lines 5896 5901 +5
==========================================
+ Hits 4830 4832 +2
- Misses 1066 1069 +3
|
@jywarren I'm guessing I should be concered about Travis CI not passing, any tips? I have to admit, I have some familiarity with Ruby, but more with JS. I wonder if there's something wrong with my syntax that's causing any errors? Also, maybe I should actually test this out locally. 🤦♂️ I'm still getting used to the codebase-- do you know where exactly this code is used, and how to see it in action? I'm guessing this is for something like updating userinfo in the profile page. Thanks for the help |
Hi, no problem! The test logs should show us what went wrong. Indeed, this should be when editing your profile, at Let's see -- We could try these out by opening the code in GitPod using the button above. But, let's see if the errors are readable. An integration test failed:
And a functional test failed:
Both show
-- could we be using the wrong instance variable for the model? Let's take a look... |
app/views/users/_edit_form.html.erb
Outdated
@@ -2,8 +2,15 @@ | |||
<%= form_for @user, :url => {:controller => 'users', :action => 'update'}, :html => {:class => "row",:id => 'edit-form' } do |f| %> | |||
<%= hidden_field_tag "user[ui_update]", "true" %> | |||
<div class="col-md-10"> | |||
<% if f.error_messages != "" %> | |||
<div class="alert alert-danger"><%= f.error_messages %></div> | |||
<% if @model.errors.any? %> |
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.
Aha! Yes, so here, the @model
is a placeholder - we can replace it with @user
and this should start to work! For all lines below as well. Sorry that was a bit ambiguous! This way it'll get the errors for the @user
object.
Let's try that! Great work so far!
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.
@jywarren Great thank you, looking through various files right now and I'm seeing I could have researched it further in users_controller.rb...
Just committed the corrections, looks like the tests are passing. Thanks again and let me know if there's anything else! 👍
Code Climate has analyzed commit 745fc48 and detected 0 issues on this pull request. View more on Code Climate. |
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.
Great! It worked!!! Great job!!
Congrats on merging your first pull request! 🙌🎉⚡️ Help others take their first stepNow that you've merged your first pull request, you're the perfect person to help someone else out with this challenging first step. 🙌 Try looking at this list of `first-timers-only` issues, and see if someone else is waiting for feedback, or even stuck! 😕 People often get stuck at the same steps, so you might be able to help someone get unstuck, or help lead them to some documentation that'd help. Reach out and be encouraging and friendly! 😄 🎉 Read about how to help support another newcomer here, or find other ways to offer mutual support here. |
🎉 |
…lab#8545 (publiclab#8553) * refactor error message * change @model to @user
…lab#8545 (publiclab#8553) * refactor error message * change @model to @user
…lab#8545 (publiclab#8553) * refactor error message * change @model to @user
…lab#8545 (publiclab#8553) * refactor error message * change @model to @user
…lab#8545 (publiclab#8553) * refactor error message * change @model to @user
…lab#8545 (publiclab#8553) * refactor error message * change @model to @user
Partially fixes #8545 in one location: plots2/app/views/users/_edit_form.html.erb