{"action":"created","comment":{"url":"https://api.github.com/repos/andela/eventx/pulls/comments/55209019","id":55209019,"diff_hunk":"@@ -30,36 +28,66 @@ def show\n   end\n \n   def edit\n+    @roles = Event.get_roles\n+  end\n+\n+  def enable\n+    @event.enabled = true\n+    @event.save\n+    redirect_to :back\n+  end\n+\n+  def disable\n+    @event.enabled = false\n+    @event.save\n+    redirect_to :back\n   end\n \n   def update\n     @event.event_staffs.delete_all\n-    if @event.update(event_params)\n-      flash[:notice] = \"Your Event was successfully updated\"\n-      respond_with(@event)\n-    else\n-      flash[:notice] = \"Your Event was not updated\"\n-      respond_with(@event)\n-    end\n+    flash[:notice] = if @event.update(event_params)\n+                       \"Your Event was successfully updated\"\n+                     else\n+                       @event.errors.full_messages.join(\"; \")\n+                     end\n+    respond_with(@event)\n   end\n \n   def create\n+    @roles = Event.get_roles\n     @event = Event.new(event_params).decorate\n     @event.manager_profile = current_user.manager_profile\n     @event.title = @event.title.strip\n-    if @event.save\n-      # @event.event_staffs.create(user: current_user).event_manager!\n-      flash[:notice] = \"Your Event was successfully created.\"\n-    else\n-      flash[:notice] = @event.errors.full_messages.join(\"<br />\")\n-    end\n+    flash[:notice] = if @event.save\n+                       \"Your Event was successfully created.\"\n+                     else\n+                       @event.errors.full_messages.join(\"; \")\n+                     end\n     respond_with(@event)\n   end\n \n+  def generate\n+    @event = Event.find(params[:id])\n+    event = Icalendar::Event.new\n+    event.dtstart = @event.start_date.strftime(\"%Y%m%dT%H%M%S\")\n+    event.dtend = @event.end_date.strftime(\"%Y%m%dT%H%M%S\")\n+    event.summary = @event.title\n+    event.description = @event.description\n+    event.location = @event.location\n+    event.uid = \"#{request.protocol}#{request.host}/events/#{params[:id]}\"\n+\n+    @calendar = Icalendar::Calendar.new\n+    @calendar.add_event(event)\n+    @calendar.publish\n+    headers['Content-Type'] = \"text/calendar; charset=UTF-8;\"","path":"app/controllers/events_controller.rb","position":95,"original_position":95,"commit_id":"ed5c3bc87858dd01ca5a3e2d0dd8c1bda930ac8f","original_commit_id":"ed5c3bc87858dd01ca5a3e2d0dd8c1bda930ac8f","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.","created_at":"2016-03-07T14:23:09Z","updated_at":"2016-03-07T14:23:09Z","html_url":"https://github.com/andela/eventx/pull/133#discussion_r55209019","pull_request_url":"https://api.github.com/repos/andela/eventx/pulls/133","_links":{"self":{"href":"https://api.github.com/repos/andela/eventx/pulls/comments/55209019"},"html":{"href":"https://github.com/andela/eventx/pull/133#discussion_r55209019"},"pull_request":{"href":"https://api.github.com/repos/andela/eventx/pulls/133"}}},"pull_request":{"url":"https://api.github.com/repos/andela/eventx/pulls/133","id":61923124,"html_url":"https://github.com/andela/eventx/pull/133","diff_url":"https://github.com/andela/eventx/pull/133.diff","patch_url":"https://github.com/andela/eventx/pull/133.patch","issue_url":"https://api.github.com/repos/andela/eventx/issues/133","number":133,"state":"open","locked":false,"title":"Ft add to calendar 114780531","user":{"login":"andela-oesho","id":14160244,"avatar_url":"https://avatars.githubusercontent.com/u/14160244?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-oesho","html_url":"https://github.com/andela-oesho","followers_url":"https://api.github.com/users/andela-oesho/followers","following_url":"https://api.github.com/users/andela-oesho/following{/other_user}","gists_url":"https://api.github.com/users/andela-oesho/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-oesho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-oesho/subscriptions","organizations_url":"https://api.github.com/users/andela-oesho/orgs","repos_url":"https://api.github.com/users/andela-oesho/repos","events_url":"https://api.github.com/users/andela-oesho/events{/privacy}","received_events_url":"https://api.github.com/users/andela-oesho/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-07T14:22:58Z","updated_at":"2016-03-07T14:23:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/andela/eventx/pulls/133/commits","review_comments_url":"https://api.github.com/repos/andela/eventx/pulls/133/comments","review_comment_url":"https://api.github.com/repos/andela/eventx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela/eventx/issues/133/comments","statuses_url":"https://api.github.com/repos/andela/eventx/statuses/ed5c3bc87858dd01ca5a3e2d0dd8c1bda930ac8f","head":{"label":"andela:ft-add-to-calendar-114780531","ref":"ft-add-to-calendar-114780531","sha":"ed5c3bc87858dd01ca5a3e2d0dd8c1bda930ac8f","user":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":39064541,"name":"eventx","full_name":"andela/eventx","owner":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/eventx","description":"","fork":false,"url":"https://api.github.com/repos/andela/eventx","forks_url":"https://api.github.com/repos/andela/eventx/forks","keys_url":"https://api.github.com/repos/andela/eventx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/eventx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/eventx/teams","hooks_url":"https://api.github.com/repos/andela/eventx/hooks","issue_events_url":"https://api.github.com/repos/andela/eventx/issues/events{/number}","events_url":"https://api.github.com/repos/andela/eventx/events","assignees_url":"https://api.github.com/repos/andela/eventx/assignees{/user}","branches_url":"https://api.github.com/repos/andela/eventx/branches{/branch}","tags_url":"https://api.github.com/repos/andela/eventx/tags","blobs_url":"https://api.github.com/repos/andela/eventx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/eventx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/eventx/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/eventx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/eventx/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/eventx/languages","stargazers_url":"https://api.github.com/repos/andela/eventx/stargazers","contributors_url":"https://api.github.com/repos/andela/eventx/contributors","subscribers_url":"https://api.github.com/repos/andela/eventx/subscribers","subscription_url":"https://api.github.com/repos/andela/eventx/subscription","commits_url":"https://api.github.com/repos/andela/eventx/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/eventx/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/eventx/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/eventx/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/eventx/contents/{+path}","compare_url":"https://api.github.com/repos/andela/eventx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/eventx/merges","archive_url":"https://api.github.com/repos/andela/eventx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/eventx/downloads","issues_url":"https://api.github.com/repos/andela/eventx/issues{/number}","pulls_url":"https://api.github.com/repos/andela/eventx/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/eventx/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/eventx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/eventx/labels{/name}","releases_url":"https://api.github.com/repos/andela/eventx/releases{/id}","deployments_url":"https://api.github.com/repos/andela/eventx/deployments","created_at":"2015-07-14T08:57:10Z","updated_at":"2016-03-02T18:22:33Z","pushed_at":"2016-03-07T14:22:58Z","git_url":"git://github.com/andela/eventx.git","ssh_url":"git@github.com:andela/eventx.git","clone_url":"https://github.com/andela/eventx.git","svn_url":"https://github.com/andela/eventx","homepage":null,"size":28426,"stargazers_count":3,"watchers_count":3,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"andela:master","ref":"master","sha":"438e8f1173bde6bd96c7ed83e8783f8acb25fb22","user":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":39064541,"name":"eventx","full_name":"andela/eventx","owner":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/eventx","description":"","fork":false,"url":"https://api.github.com/repos/andela/eventx","forks_url":"https://api.github.com/repos/andela/eventx/forks","keys_url":"https://api.github.com/repos/andela/eventx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/eventx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/eventx/teams","hooks_url":"https://api.github.com/repos/andela/eventx/hooks","issue_events_url":"https://api.github.com/repos/andela/eventx/issues/events{/number}","events_url":"https://api.github.com/repos/andela/eventx/events","assignees_url":"https://api.github.com/repos/andela/eventx/assignees{/user}","branches_url":"https://api.github.com/repos/andela/eventx/branches{/branch}","tags_url":"https://api.github.com/repos/andela/eventx/tags","blobs_url":"https://api.github.com/repos/andela/eventx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/eventx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/eventx/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/eventx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/eventx/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/eventx/languages","stargazers_url":"https://api.github.com/repos/andela/eventx/stargazers","contributors_url":"https://api.github.com/repos/andela/eventx/contributors","subscribers_url":"https://api.github.com/repos/andela/eventx/subscribers","subscription_url":"https://api.github.com/repos/andela/eventx/subscription","commits_url":"https://api.github.com/repos/andela/eventx/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/eventx/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/eventx/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/eventx/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/eventx/contents/{+path}","compare_url":"https://api.github.com/repos/andela/eventx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/eventx/merges","archive_url":"https://api.github.com/repos/andela/eventx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/eventx/downloads","issues_url":"https://api.github.com/repos/andela/eventx/issues{/number}","pulls_url":"https://api.github.com/repos/andela/eventx/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/eventx/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/eventx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/eventx/labels{/name}","releases_url":"https://api.github.com/repos/andela/eventx/releases{/id}","deployments_url":"https://api.github.com/repos/andela/eventx/deployments","created_at":"2015-07-14T08:57:10Z","updated_at":"2016-03-02T18:22:33Z","pushed_at":"2016-03-07T14:22:58Z","git_url":"git://github.com/andela/eventx.git","ssh_url":"git@github.com:andela/eventx.git","clone_url":"https://github.com/andela/eventx.git","svn_url":"https://github.com/andela/eventx","homepage":null,"size":28426,"stargazers_count":3,"watchers_count":3,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/andela/eventx/pulls/133"},"html":{"href":"https://github.com/andela/eventx/pull/133"},"issue":{"href":"https://api.github.com/repos/andela/eventx/issues/133"},"comments":{"href":"https://api.github.com/repos/andela/eventx/issues/133/comments"},"review_comments":{"href":"https://api.github.com/repos/andela/eventx/pulls/133/comments"},"review_comment":{"href":"https://api.github.com/repos/andela/eventx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela/eventx/pulls/133/commits"},"statuses":{"href":"https://api.github.com/repos/andela/eventx/statuses/ed5c3bc87858dd01ca5a3e2d0dd8c1bda930ac8f"}}}}