{"action":"created","comment":{"url":"https://api.github.com/repos/fsek/web/pulls/comments/27120584","id":27120584,"diff_hunk":"@@ -1,28 +1,54 @@\n # encoding:UTF-8\n class ApplicationController < ActionController::Base\n-  include TheRole::Controller\n   protect_from_forgery\n \n   before_filter :configure_permitted_devise_parameters, if: :devise_controller?\n   before_filter :set_locale\n \n+  rescue_from CanCan::AccessDenied do |ex|\n+    flash[:error] = ex.message\n+    render :text => '', :layout => true, :status => :forbidden\n+  end\n \n-  def access_denied\n-    flash[:error] = t('the_role.access_denied')\n-    redirect_to(:back)\n-\n-  rescue ActionController::RedirectBackError\n-    redirect_to root_path\n-  end \n+  rescue_from ActiveRecord::RecordInvalid do |ex|\n+    flash[:error] = \n+      \"Fel i formulär:  #{ex.record.errors.full_messages.join '; '}\"\n+    render referring_action, :status => :unprocessable_entity\n+  end\n \n   protected\n-\n   def configure_permitted_devise_parameters\n     devise_parameter_sanitizer.for(:sign_in) {|u| u.permit(:username, :password, :remember_me)}\n     devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:username, :email, :password, :password_confirmation) }\n     devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:password, :password_confirmation, :current_password) }\n   end\n \n+  def self.permission\n+    self.name.gsub('Controller','').singularize.split('::').last.constantize.name rescue nil","path":"app/controllers/application_controller.rb","position":36,"original_position":36,"commit_id":"a80bc9eff2986b2811bc476f7eddabcb26b0f8f9","original_commit_id":"a80bc9eff2986b2811bc476f7eddabcb26b0f8f9","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Redundant `self` detected.<br>Space missing after comma.","created_at":"2015-03-25T13:43:49Z","updated_at":"2015-03-25T13:43:49Z","html_url":"https://github.com/fsek/web/pull/69#discussion_r27120584","pull_request_url":"https://api.github.com/repos/fsek/web/pulls/69","_links":{"self":{"href":"https://api.github.com/repos/fsek/web/pulls/comments/27120584"},"html":{"href":"https://github.com/fsek/web/pull/69#discussion_r27120584"},"pull_request":{"href":"https://api.github.com/repos/fsek/web/pulls/69"}}},"pull_request":{"url":"https://api.github.com/repos/fsek/web/pulls/69","id":31517916,"html_url":"https://github.com/fsek/web/pull/69","diff_url":"https://github.com/fsek/web/pull/69.diff","patch_url":"https://github.com/fsek/web/pull/69.patch","issue_url":"https://api.github.com/repos/fsek/web/issues/69","number":69,"state":"open","locked":false,"title":"Switch auth system to cancan(can)","user":{"login":"henrikssn","id":859779,"avatar_url":"https://avatars.githubusercontent.com/u/859779?v=3","gravatar_id":"","url":"https://api.github.com/users/henrikssn","html_url":"https://github.com/henrikssn","followers_url":"https://api.github.com/users/henrikssn/followers","following_url":"https://api.github.com/users/henrikssn/following{/other_user}","gists_url":"https://api.github.com/users/henrikssn/gists{/gist_id}","starred_url":"https://api.github.com/users/henrikssn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrikssn/subscriptions","organizations_url":"https://api.github.com/users/henrikssn/orgs","repos_url":"https://api.github.com/users/henrikssn/repos","events_url":"https://api.github.com/users/henrikssn/events{/privacy}","received_events_url":"https://api.github.com/users/henrikssn/received_events","type":"User","site_admin":false},"body":"This PR will migrate the code base from TheRole to cancancan.\r\n\r\nSolves #67 and needs #68 \r\n\r\nNote: Work in progress, help is very welcome!","created_at":"2015-03-19T12:19:32Z","updated_at":"2015-03-25T13:43:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7f0d616f54e889e8333ab7286757f4d809517e2a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fsek/web/pulls/69/commits","review_comments_url":"https://api.github.com/repos/fsek/web/pulls/69/comments","review_comment_url":"https://api.github.com/repos/fsek/web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fsek/web/issues/69/comments","statuses_url":"https://api.github.com/repos/fsek/web/statuses/a80bc9eff2986b2811bc476f7eddabcb26b0f8f9","head":{"label":"fsek:cancan","ref":"cancan","sha":"a80bc9eff2986b2811bc476f7eddabcb26b0f8f9","user":{"login":"fsek","id":10084654,"avatar_url":"https://avatars.githubusercontent.com/u/10084654?v=3","gravatar_id":"","url":"https://api.github.com/users/fsek","html_url":"https://github.com/fsek","followers_url":"https://api.github.com/users/fsek/followers","following_url":"https://api.github.com/users/fsek/following{/other_user}","gists_url":"https://api.github.com/users/fsek/gists{/gist_id}","starred_url":"https://api.github.com/users/fsek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsek/subscriptions","organizations_url":"https://api.github.com/users/fsek/orgs","repos_url":"https://api.github.com/users/fsek/repos","events_url":"https://api.github.com/users/fsek/events{/privacy}","received_events_url":"https://api.github.com/users/fsek/received_events","type":"Organization","site_admin":false},"repo":{"id":27583674,"name":"web","full_name":"fsek/web","owner":{"login":"fsek","id":10084654,"avatar_url":"https://avatars.githubusercontent.com/u/10084654?v=3","gravatar_id":"","url":"https://api.github.com/users/fsek","html_url":"https://github.com/fsek","followers_url":"https://api.github.com/users/fsek/followers","following_url":"https://api.github.com/users/fsek/following{/other_user}","gists_url":"https://api.github.com/users/fsek/gists{/gist_id}","starred_url":"https://api.github.com/users/fsek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsek/subscriptions","organizations_url":"https://api.github.com/users/fsek/orgs","repos_url":"https://api.github.com/users/fsek/repos","events_url":"https://api.github.com/users/fsek/events{/privacy}","received_events_url":"https://api.github.com/users/fsek/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fsek/web","description":"F-sektionens hemsida","fork":false,"url":"https://api.github.com/repos/fsek/web","forks_url":"https://api.github.com/repos/fsek/web/forks","keys_url":"https://api.github.com/repos/fsek/web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fsek/web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fsek/web/teams","hooks_url":"https://api.github.com/repos/fsek/web/hooks","issue_events_url":"https://api.github.com/repos/fsek/web/issues/events{/number}","events_url":"https://api.github.com/repos/fsek/web/events","assignees_url":"https://api.github.com/repos/fsek/web/assignees{/user}","branches_url":"https://api.github.com/repos/fsek/web/branches{/branch}","tags_url":"https://api.github.com/repos/fsek/web/tags","blobs_url":"https://api.github.com/repos/fsek/web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fsek/web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fsek/web/git/refs{/sha}","trees_url":"https://api.github.com/repos/fsek/web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fsek/web/statuses/{sha}","languages_url":"https://api.github.com/repos/fsek/web/languages","stargazers_url":"https://api.github.com/repos/fsek/web/stargazers","contributors_url":"https://api.github.com/repos/fsek/web/contributors","subscribers_url":"https://api.github.com/repos/fsek/web/subscribers","subscription_url":"https://api.github.com/repos/fsek/web/subscription","commits_url":"https://api.github.com/repos/fsek/web/commits{/sha}","git_commits_url":"https://api.github.com/repos/fsek/web/git/commits{/sha}","comments_url":"https://api.github.com/repos/fsek/web/comments{/number}","issue_comment_url":"https://api.github.com/repos/fsek/web/issues/comments{/number}","contents_url":"https://api.github.com/repos/fsek/web/contents/{+path}","compare_url":"https://api.github.com/repos/fsek/web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fsek/web/merges","archive_url":"https://api.github.com/repos/fsek/web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fsek/web/downloads","issues_url":"https://api.github.com/repos/fsek/web/issues{/number}","pulls_url":"https://api.github.com/repos/fsek/web/pulls{/number}","milestones_url":"https://api.github.com/repos/fsek/web/milestones{/number}","notifications_url":"https://api.github.com/repos/fsek/web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fsek/web/labels{/name}","releases_url":"https://api.github.com/repos/fsek/web/releases{/id}","created_at":"2014-12-05T09:13:19Z","updated_at":"2015-03-25T08:45:15Z","pushed_at":"2015-03-25T13:43:40Z","git_url":"git://github.com/fsek/web.git","ssh_url":"git@github.com:fsek/web.git","clone_url":"https://github.com/fsek/web.git","svn_url":"https://github.com/fsek/web","homepage":"http://fsektionen.se","size":210197,"stargazers_count":1,"watchers_count":1,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":49,"forks":1,"open_issues":49,"watchers":1,"default_branch":"master"}},"base":{"label":"fsek:master","ref":"master","sha":"b5f55848ffaebd4f26973e952fb90bb553677191","user":{"login":"fsek","id":10084654,"avatar_url":"https://avatars.githubusercontent.com/u/10084654?v=3","gravatar_id":"","url":"https://api.github.com/users/fsek","html_url":"https://github.com/fsek","followers_url":"https://api.github.com/users/fsek/followers","following_url":"https://api.github.com/users/fsek/following{/other_user}","gists_url":"https://api.github.com/users/fsek/gists{/gist_id}","starred_url":"https://api.github.com/users/fsek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsek/subscriptions","organizations_url":"https://api.github.com/users/fsek/orgs","repos_url":"https://api.github.com/users/fsek/repos","events_url":"https://api.github.com/users/fsek/events{/privacy}","received_events_url":"https://api.github.com/users/fsek/received_events","type":"Organization","site_admin":false},"repo":{"id":27583674,"name":"web","full_name":"fsek/web","owner":{"login":"fsek","id":10084654,"avatar_url":"https://avatars.githubusercontent.com/u/10084654?v=3","gravatar_id":"","url":"https://api.github.com/users/fsek","html_url":"https://github.com/fsek","followers_url":"https://api.github.com/users/fsek/followers","following_url":"https://api.github.com/users/fsek/following{/other_user}","gists_url":"https://api.github.com/users/fsek/gists{/gist_id}","starred_url":"https://api.github.com/users/fsek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsek/subscriptions","organizations_url":"https://api.github.com/users/fsek/orgs","repos_url":"https://api.github.com/users/fsek/repos","events_url":"https://api.github.com/users/fsek/events{/privacy}","received_events_url":"https://api.github.com/users/fsek/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fsek/web","description":"F-sektionens hemsida","fork":false,"url":"https://api.github.com/repos/fsek/web","forks_url":"https://api.github.com/repos/fsek/web/forks","keys_url":"https://api.github.com/repos/fsek/web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fsek/web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fsek/web/teams","hooks_url":"https://api.github.com/repos/fsek/web/hooks","issue_events_url":"https://api.github.com/repos/fsek/web/issues/events{/number}","events_url":"https://api.github.com/repos/fsek/web/events","assignees_url":"https://api.github.com/repos/fsek/web/assignees{/user}","branches_url":"https://api.github.com/repos/fsek/web/branches{/branch}","tags_url":"https://api.github.com/repos/fsek/web/tags","blobs_url":"https://api.github.com/repos/fsek/web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fsek/web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fsek/web/git/refs{/sha}","trees_url":"https://api.github.com/repos/fsek/web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fsek/web/statuses/{sha}","languages_url":"https://api.github.com/repos/fsek/web/languages","stargazers_url":"https://api.github.com/repos/fsek/web/stargazers","contributors_url":"https://api.github.com/repos/fsek/web/contributors","subscribers_url":"https://api.github.com/repos/fsek/web/subscribers","subscription_url":"https://api.github.com/repos/fsek/web/subscription","commits_url":"https://api.github.com/repos/fsek/web/commits{/sha}","git_commits_url":"https://api.github.com/repos/fsek/web/git/commits{/sha}","comments_url":"https://api.github.com/repos/fsek/web/comments{/number}","issue_comment_url":"https://api.github.com/repos/fsek/web/issues/comments{/number}","contents_url":"https://api.github.com/repos/fsek/web/contents/{+path}","compare_url":"https://api.github.com/repos/fsek/web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fsek/web/merges","archive_url":"https://api.github.com/repos/fsek/web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fsek/web/downloads","issues_url":"https://api.github.com/repos/fsek/web/issues{/number}","pulls_url":"https://api.github.com/repos/fsek/web/pulls{/number}","milestones_url":"https://api.github.com/repos/fsek/web/milestones{/number}","notifications_url":"https://api.github.com/repos/fsek/web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fsek/web/labels{/name}","releases_url":"https://api.github.com/repos/fsek/web/releases{/id}","created_at":"2014-12-05T09:13:19Z","updated_at":"2015-03-25T08:45:15Z","pushed_at":"2015-03-25T13:43:40Z","git_url":"git://github.com/fsek/web.git","ssh_url":"git@github.com:fsek/web.git","clone_url":"https://github.com/fsek/web.git","svn_url":"https://github.com/fsek/web","homepage":"http://fsektionen.se","size":210197,"stargazers_count":1,"watchers_count":1,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":49,"forks":1,"open_issues":49,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fsek/web/pulls/69"},"html":{"href":"https://github.com/fsek/web/pull/69"},"issue":{"href":"https://api.github.com/repos/fsek/web/issues/69"},"comments":{"href":"https://api.github.com/repos/fsek/web/issues/69/comments"},"review_comments":{"href":"https://api.github.com/repos/fsek/web/pulls/69/comments"},"review_comment":{"href":"https://api.github.com/repos/fsek/web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fsek/web/pulls/69/commits"},"statuses":{"href":"https://api.github.com/repos/fsek/web/statuses/a80bc9eff2986b2811bc476f7eddabcb26b0f8f9"}}}}