-
-
Save tubbo/c5507ad82fc53817c09e1ad0075c5533 to your computer and use it in GitHub Desktop.
Need to move Logic From the View into The Model, Rails v. 4.2, The current entry in the model for setting the gender in comments, works correctly because comment is an attribute of report. Would like to move the logic currently in the view to the model, however I am unsure of how to because content is an attribute of intro, which is a nested res…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def genderized_comment | |
comment.gsub(/HESHE/, gender_pronoun.capitalize) | |
end | |
def gender_pronoun | |
gender == 'female' ? 'she' : 'he' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p><%= @report.genderized_comment %></p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment