{"action":"created","comment":{"url":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls/comments/40467334","id":40467334,"diff_hunk":"@@ -2,4 +2,18 @@ class ScheduledMessage < ActiveRecord::Base\n   validates :body, presence: true\n   validates :days_after_start, presence: true\n   validates :title, presence: true\n+\n+  before_save :escape_specific_characters\n+\n+  def body\n+    self[:body].html_safe if self[:body]","path":"app/models/scheduled_message.rb","position":8,"original_position":8,"commit_id":"ec8ce674bef84796981cf6cfe9e4bfd65636e3cc","original_commit_id":"ec8ce674bef84796981cf6cfe9e4bfd65636e3cc","user":{"login":"ccostino","id":121565,"avatar_url":"https://avatars.githubusercontent.com/u/121565?v=3","gravatar_id":"","url":"https://api.github.com/users/ccostino","html_url":"https://github.com/ccostino","followers_url":"https://api.github.com/users/ccostino/followers","following_url":"https://api.github.com/users/ccostino/following{/other_user}","gists_url":"https://api.github.com/users/ccostino/gists{/gist_id}","starred_url":"https://api.github.com/users/ccostino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ccostino/subscriptions","organizations_url":"https://api.github.com/users/ccostino/orgs","repos_url":"https://api.github.com/users/ccostino/repos","events_url":"https://api.github.com/users/ccostino/events{/privacy}","received_events_url":"https://api.github.com/users/ccostino/received_events","type":"User","site_admin":false},"body":"Totally fine on the style change, but in terms of validating the presence, this becomes an issue when trying to enter a new message.  There is no body yet on the object since it is being created at that point, so there is nothing to call html_safe on.  Since this method is overriding just accessing the property directly, it cannot assume that is instantiated in that case.","created_at":"2015-09-25T19:32:25Z","updated_at":"2015-09-25T19:32:25Z","html_url":"https://github.com/18F/dolores-landingham-bot/pull/39#discussion_r40467334","pull_request_url":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls/39","_links":{"self":{"href":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls/comments/40467334"},"html":{"href":"https://github.com/18F/dolores-landingham-bot/pull/39#discussion_r40467334"},"pull_request":{"href":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls/39","id":46029143,"html_url":"https://github.com/18F/dolores-landingham-bot/pull/39","diff_url":"https://github.com/18F/dolores-landingham-bot/pull/39.diff","patch_url":"https://github.com/18F/dolores-landingham-bot/pull/39.patch","issue_url":"https://api.github.com/repos/18F/dolores-landingham-bot/issues/39","number":39,"state":"open","locked":false,"title":"Fixes #30:  Escapes all special characters to their HTML entities.","user":{"login":"ccostino","id":121565,"avatar_url":"https://avatars.githubusercontent.com/u/121565?v=3","gravatar_id":"","url":"https://api.github.com/users/ccostino","html_url":"https://github.com/ccostino","followers_url":"https://api.github.com/users/ccostino/followers","following_url":"https://api.github.com/users/ccostino/following{/other_user}","gists_url":"https://api.github.com/users/ccostino/gists{/gist_id}","starred_url":"https://api.github.com/users/ccostino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ccostino/subscriptions","organizations_url":"https://api.github.com/users/ccostino/orgs","repos_url":"https://api.github.com/users/ccostino/repos","events_url":"https://api.github.com/users/ccostino/events{/privacy}","received_events_url":"https://api.github.com/users/ccostino/received_events","type":"User","site_admin":false},"body":"This will escape all special characters to their corresponding HTML entities, but it will also display the messages normally when viewing/editing them.\r\n\r\nMy Rails-fu is not as great as my Django-fu, so if there is a better way of accomplishing this please let me know!","created_at":"2015-09-25T16:08:12Z","updated_at":"2015-09-25T19:32:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6a167dab48d74023cf3ae517747e55714750b24b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls/39/commits","review_comments_url":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls/39/comments","review_comment_url":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/18F/dolores-landingham-bot/issues/39/comments","statuses_url":"https://api.github.com/repos/18F/dolores-landingham-bot/statuses/ec8ce674bef84796981cf6cfe9e4bfd65636e3cc","head":{"label":"18F:cc-issue-30-escape-special-characters-in-messages","ref":"cc-issue-30-escape-special-characters-in-messages","sha":"ec8ce674bef84796981cf6cfe9e4bfd65636e3cc","user":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"repo":{"id":42547221,"name":"dolores-landingham-bot","full_name":"18F/dolores-landingham-bot","owner":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/18F/dolores-landingham-bot","description":"A Slack bot to welcome new 18F hires with the authority and compassion of Mrs. Landingham","fork":false,"url":"https://api.github.com/repos/18F/dolores-landingham-bot","forks_url":"https://api.github.com/repos/18F/dolores-landingham-bot/forks","keys_url":"https://api.github.com/repos/18F/dolores-landingham-bot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/18F/dolores-landingham-bot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/18F/dolores-landingham-bot/teams","hooks_url":"https://api.github.com/repos/18F/dolores-landingham-bot/hooks","issue_events_url":"https://api.github.com/repos/18F/dolores-landingham-bot/issues/events{/number}","events_url":"https://api.github.com/repos/18F/dolores-landingham-bot/events","assignees_url":"https://api.github.com/repos/18F/dolores-landingham-bot/assignees{/user}","branches_url":"https://api.github.com/repos/18F/dolores-landingham-bot/branches{/branch}","tags_url":"https://api.github.com/repos/18F/dolores-landingham-bot/tags","blobs_url":"https://api.github.com/repos/18F/dolores-landingham-bot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/18F/dolores-landingham-bot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/18F/dolores-landingham-bot/git/refs{/sha}","trees_url":"https://api.github.com/repos/18F/dolores-landingham-bot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/18F/dolores-landingham-bot/statuses/{sha}","languages_url":"https://api.github.com/repos/18F/dolores-landingham-bot/languages","stargazers_url":"https://api.github.com/repos/18F/dolores-landingham-bot/stargazers","contributors_url":"https://api.github.com/repos/18F/dolores-landingham-bot/contributors","subscribers_url":"https://api.github.com/repos/18F/dolores-landingham-bot/subscribers","subscription_url":"https://api.github.com/repos/18F/dolores-landingham-bot/subscription","commits_url":"https://api.github.com/repos/18F/dolores-landingham-bot/commits{/sha}","git_commits_url":"https://api.github.com/repos/18F/dolores-landingham-bot/git/commits{/sha}","comments_url":"https://api.github.com/repos/18F/dolores-landingham-bot/comments{/number}","issue_comment_url":"https://api.github.com/repos/18F/dolores-landingham-bot/issues/comments{/number}","contents_url":"https://api.github.com/repos/18F/dolores-landingham-bot/contents/{+path}","compare_url":"https://api.github.com/repos/18F/dolores-landingham-bot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/18F/dolores-landingham-bot/merges","archive_url":"https://api.github.com/repos/18F/dolores-landingham-bot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/18F/dolores-landingham-bot/downloads","issues_url":"https://api.github.com/repos/18F/dolores-landingham-bot/issues{/number}","pulls_url":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls{/number}","milestones_url":"https://api.github.com/repos/18F/dolores-landingham-bot/milestones{/number}","notifications_url":"https://api.github.com/repos/18F/dolores-landingham-bot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/18F/dolores-landingham-bot/labels{/name}","releases_url":"https://api.github.com/repos/18F/dolores-landingham-bot/releases{/id}","created_at":"2015-09-15T21:19:01Z","updated_at":"2015-09-23T20:42:04Z","pushed_at":"2015-09-25T19:16:21Z","git_url":"git://github.com/18F/dolores-landingham-bot.git","ssh_url":"git@github.com:18F/dolores-landingham-bot.git","clone_url":"https://github.com/18F/dolores-landingham-bot.git","svn_url":"https://github.com/18F/dolores-landingham-bot","homepage":null,"size":536,"stargazers_count":4,"watchers_count":4,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":19,"forks":0,"open_issues":19,"watchers":4,"default_branch":"master"}},"base":{"label":"18F:master","ref":"master","sha":"52bb8b2fbd21633d0c5066ce850b5b0f0bae41fc","user":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"repo":{"id":42547221,"name":"dolores-landingham-bot","full_name":"18F/dolores-landingham-bot","owner":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/18F/dolores-landingham-bot","description":"A Slack bot to welcome new 18F hires with the authority and compassion of Mrs. Landingham","fork":false,"url":"https://api.github.com/repos/18F/dolores-landingham-bot","forks_url":"https://api.github.com/repos/18F/dolores-landingham-bot/forks","keys_url":"https://api.github.com/repos/18F/dolores-landingham-bot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/18F/dolores-landingham-bot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/18F/dolores-landingham-bot/teams","hooks_url":"https://api.github.com/repos/18F/dolores-landingham-bot/hooks","issue_events_url":"https://api.github.com/repos/18F/dolores-landingham-bot/issues/events{/number}","events_url":"https://api.github.com/repos/18F/dolores-landingham-bot/events","assignees_url":"https://api.github.com/repos/18F/dolores-landingham-bot/assignees{/user}","branches_url":"https://api.github.com/repos/18F/dolores-landingham-bot/branches{/branch}","tags_url":"https://api.github.com/repos/18F/dolores-landingham-bot/tags","blobs_url":"https://api.github.com/repos/18F/dolores-landingham-bot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/18F/dolores-landingham-bot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/18F/dolores-landingham-bot/git/refs{/sha}","trees_url":"https://api.github.com/repos/18F/dolores-landingham-bot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/18F/dolores-landingham-bot/statuses/{sha}","languages_url":"https://api.github.com/repos/18F/dolores-landingham-bot/languages","stargazers_url":"https://api.github.com/repos/18F/dolores-landingham-bot/stargazers","contributors_url":"https://api.github.com/repos/18F/dolores-landingham-bot/contributors","subscribers_url":"https://api.github.com/repos/18F/dolores-landingham-bot/subscribers","subscription_url":"https://api.github.com/repos/18F/dolores-landingham-bot/subscription","commits_url":"https://api.github.com/repos/18F/dolores-landingham-bot/commits{/sha}","git_commits_url":"https://api.github.com/repos/18F/dolores-landingham-bot/git/commits{/sha}","comments_url":"https://api.github.com/repos/18F/dolores-landingham-bot/comments{/number}","issue_comment_url":"https://api.github.com/repos/18F/dolores-landingham-bot/issues/comments{/number}","contents_url":"https://api.github.com/repos/18F/dolores-landingham-bot/contents/{+path}","compare_url":"https://api.github.com/repos/18F/dolores-landingham-bot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/18F/dolores-landingham-bot/merges","archive_url":"https://api.github.com/repos/18F/dolores-landingham-bot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/18F/dolores-landingham-bot/downloads","issues_url":"https://api.github.com/repos/18F/dolores-landingham-bot/issues{/number}","pulls_url":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls{/number}","milestones_url":"https://api.github.com/repos/18F/dolores-landingham-bot/milestones{/number}","notifications_url":"https://api.github.com/repos/18F/dolores-landingham-bot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/18F/dolores-landingham-bot/labels{/name}","releases_url":"https://api.github.com/repos/18F/dolores-landingham-bot/releases{/id}","created_at":"2015-09-15T21:19:01Z","updated_at":"2015-09-23T20:42:04Z","pushed_at":"2015-09-25T19:16:21Z","git_url":"git://github.com/18F/dolores-landingham-bot.git","ssh_url":"git@github.com:18F/dolores-landingham-bot.git","clone_url":"https://github.com/18F/dolores-landingham-bot.git","svn_url":"https://github.com/18F/dolores-landingham-bot","homepage":null,"size":536,"stargazers_count":4,"watchers_count":4,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":19,"forks":0,"open_issues":19,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls/39"},"html":{"href":"https://github.com/18F/dolores-landingham-bot/pull/39"},"issue":{"href":"https://api.github.com/repos/18F/dolores-landingham-bot/issues/39"},"comments":{"href":"https://api.github.com/repos/18F/dolores-landingham-bot/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/18F/dolores-landingham-bot/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/18F/dolores-landingham-bot/statuses/ec8ce674bef84796981cf6cfe9e4bfd65636e3cc"}}}}