Skip to content

Instantly share code, notes, and snippets.

@tubbo
Forked from wolfravenous/model.rb
Last active October 5, 2016 14:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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…
def genderized_comment
comment.gsub(/HESHE/, gender_pronoun.capitalize)
end
def gender_pronoun
gender == 'female' ? 'she' : 'he'
end
<p><%= @report.genderized_comment %></p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment