GitHub PullRequestReviewCommentEvent at 2014-05-07 09:42:14
Repository: foreman
Actor: isratrade
Payload: {"comment":{"url":"https://api.github.com/repos/theforeman/foreman/pulls/comments/12368356","id":12368356,"diff_hunk":"@@ -5,22 +5,28 @@ class ConfigTemplatesController < V2::BaseController\n       include Api::TaxonomyScope\n       include Foreman::Renderer\n \n+      before_filter :find_optional_nested_object\n+      before_filter :find_resource, :only => %w{show update destroy}\n+\n       before_filter(:only => %w{show update destroy}) { find_resource('templates') }\n       before_filter :handle_template_upload, :only => [:create, :update]\n       before_filter :process_template_kind, :only => [:create, :update]\n       before_filter :process_operatingsystems, :only => [:create, :update]\n \n-      api :GET, \"/config_templates/\", \"List templates\"\n+      api :GET, \"/config_templates\", \"List templates\"\n+      api :GET, \"/operatingsystem/:operatingsystem_id/config_templates\", \"List templates per operatingsystem\"\n+      api :GET, \"/locations/:location_id/config_templates/\", \"List templates per location\"\n+      api :GET, \"/organizations/:organization_id/config_templates/\", \"List templates per organization\"\n+      param :operatingsystem_id, String, :desc => \"id of nested operatingsystem\"\n+      param :location_id, String, :desc => \"id of nested location\"\n+      param :organization_id, String, :desc => \"id of nested organization\"\n       param :search, String, :desc => \"filter results\"\n       param :order, String, :desc => \"sort results\"\n       param :page, String, :desc => \"paginate results\"\n       param :per_page, String, :desc => \"number of entries per request\"\n \n       def index\n-        @config_templates = ConfigTemplate.\n-          authorized(:view_templates).\n-          search_for(*search_options).paginate(paginate_options).\n-          includes(:operatingsystems, :template_combinations, :template_kind)\n+        @config_templates = resource_scope_for_index('config_templates', :permission => :view_templates).includes(:template_kind)","path":"app/controllers/api/v2/config_templates_controller.rb","position":30,"original_position":30,"commit_id":"52650bacab384c4e9e2547fbb6343a4b2a6b48aa","original_commit_id":"52650bacab384c4e9e2547fbb6343a4b2a6b48aa","user":{"login":"isratrade","id":505394,"avatar_url":"https://avatars.githubusercontent.com/u/505394?","gravatar_id":"2e3458169ec423666270dfe6ae600742","url":"https://api.github.com/users/isratrade","html_url":"https://github.com/isratrade","followers_url":"https://api.github.com/users/isratrade/followers","following_url":"https://api.github.com/users/isratrade/following{/other_user}","gists_url":"https://api.github.com/users/isratrade/gists{/gist_id}","starred_url":"https://api.github.com/users/isratrade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isratrade/subscriptions","organizations_url":"https://api.github.com/users/isratrade/orgs","repos_url":"https://api.github.com/users/isratrade/repos","events_url":"https://api.github.com/users/isratrade/events{/privacy}","received_events_url":"https://api.github.com/users/isratrade/received_events","type":"User","site_admin":false},"body":"I don't see the reason to include `operatingsystems, :template_combinations` in the `index` since this data is not in the response.","created_at":"2014-05-07T09:42:14Z","updated_at":"2014-05-07T09:42:14Z","html_url":"https://github.com/theforeman/foreman/pull/1068#discussion_r12368356","pull_request_url":"https://api.github.com/repos/theforeman/foreman/pulls/1068","_links":{"self":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/comments/12368356"},"html":{"href":"https://github.com/theforeman/foreman/pull/1068#discussion_r12368356"},"pull_request":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/1068"}}}}