Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding scope to as_non_author to phd, mastery, degree, bachelor and t…

…echnician theses scopes
  • Loading branch information...
commit aaf9b85e9bf2872d3aa307d67663d9905f11dc30 1 parent d637700
@martinezo martinezo authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 app/models/thesis.rb
View
11 app/models/thesis.rb
@@ -38,11 +38,6 @@ class Thesis < ActiveRecord::Base
}
scope :roleinthesis_id_eq, lambda { |roleinthesis_id| joins(:user_theses).where(:user_theses => { :roleinthesis_id => roleinthesis_id }) }
- scope :phd_theses, joins(:career).where('degree_id = 6')
- scope :mastery_theses, joins(:career).where('degree_id = 5 or degree_id = 4')
- scope :degree_theses, joins(:career).where('degree_id = 3')
- scope :technician_theses, joins(:career).where('degree_id = 2')
- scope :bachelor_theses, joins(:career).where('degree_id = 1')
scope :as_author, where(:user_theses => {:roleinthesis_id => 1})
scope :roleinthesis_id_not_eq, lambda { |roleinthesis_id| joins(:user_theses).where{{:user_theses => { :roleinthesis_id.not_eq => roleinthesis_id }}} }
@@ -51,6 +46,12 @@ class Thesis < ActiveRecord::Base
scope :finished, where(:thesisstatus_id => 3).as_non_author
scope :inprogress, where("thesisstatus_id != 3").as_non_author
+ scope :phd_theses, joins(:career).where('degree_id = 6').as_non_author
+ scope :mastery_theses, joins(:career).where('degree_id = 5 or degree_id = 4').as_non_author
+ scope :degree_theses, joins(:career).where('degree_id = 3').as_non_author
+ scope :technician_theses, joins(:career).where('degree_id = 2').as_non_author
+ scope :bachelor_theses, joins(:career).where('degree_id = 1').as_non_author
+
search_methods :user_id_eq, :user_id_not_eq, :roleinthesis_id_eq
def to_s
Please sign in to comment.
Something went wrong with that request. Please try again.