Skip to content

Commit

Permalink
removing the old sql queries
Browse files Browse the repository at this point in the history
  • Loading branch information
lsanchez-r7 committed Jun 9, 2015
1 parent 6c4b421 commit 82e6a0f
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions app/models/mdm/workspace.rb
Expand Up @@ -235,15 +235,6 @@ def host_tags
#
# @return [ActiveRecord::Relation<Mdm::WebForm>]
def web_forms
# query = <<-EOQ
# SELECT DISTINCT web_forms.*
# FROM hosts, services, web_sites, web_forms
# WHERE hosts.workspace_id = #{id} AND
# services.host_id = hosts.id AND
# web_sites.service_id = services.id AND
# web_forms.web_site_id = web_sites.id
# EOQ
# Mdm::WebForm.find_by_sql(query)
Mdm::WebForm.joins(
Mdm::WebForm.join_association(:web_site),
Mdm::WebSite.join_association(:service),
Expand All @@ -257,15 +248,6 @@ def web_forms
#
# @return [ActiveRecord::Relation<Mdm::WebPage>]
def web_pages
# query = <<-EOQ
# SELECT DISTINCT web_pages.*
# FROM hosts, services, web_sites, web_pages
# WHERE hosts.workspace_id = #{id} AND
# services.host_id = hosts.id AND
# web_sites.service_id = services.id AND
# web_pages.web_site_id = web_sites.id
# EOQ
# Mdm::WebPage.find_by_sql(query)
Mdm::WebPage.joins(
Mdm::WebPage.join_association(:web_site),
Mdm::WebSite.join_association(:service),
Expand All @@ -278,14 +260,6 @@ def web_pages
#
# @return [ActiveRecord::Relation<Mdm::WebSite>]
def web_sites
# query = <<-EOQ
# SELECT DISTINCT web_sites.*
# FROM hosts, services, web_sites
# WHERE hosts.workspace_id = #{id} AND
# services.host_id = hosts.id AND
# web_sites.service_id = services.id
# EOQ
# Mdm::WebSite.find_by_sql(query)
Mdm::WebSite.joins(
Mdm::WebSite.join_association(:service),
Mdm::Service.join_association(:host),
Expand All @@ -298,15 +272,6 @@ def web_sites
#
# @return [ActiveRecord::Relation<Mdm::WebVuln>]
def web_vulns
# query = <<-EOQ
# SELECT DISTINCT web_vulns.*
# FROM hosts, services, web_sites, web_vulns
# WHERE hosts.workspace_id = #{id} AND
# services.host_id = hosts.id AND
# web_sites.service_id = services.id AND
# web_vulns.web_site_id = web_sites.id
# EOQ
# Mdm::WebVuln.find_by_sql(query)
Mdm::WebVuln.joins(
Mdm::WebVuln.join_association(:web_site),
Mdm::WebSite.join_association(:service),
Expand All @@ -319,15 +284,6 @@ def web_vulns
#
# @return [ActiveRecord::Relation<Mdm::WebForm>]
def unique_web_forms
# query = <<-EOQ
# SELECT DISTINCT web_forms.web_site_id, web_forms.path, web_forms.method, web_forms.query
# FROM hosts, services, web_sites, web_forms
# WHERE hosts.workspace_id = #{id} AND
# services.host_id = hosts.id AND
# web_sites.service_id = services.id AND
# web_forms.web_site_id = web_sites.id
# EOQ
# Mdm::WebForm.find_by_sql(query)
web_forms.select('web_forms.id, web_forms.web_site_id, web_forms.path, web_forms.method, web_forms.query')
end

Expand Down

0 comments on commit 82e6a0f

Please sign in to comment.