Andrew Kane 8 лет назад
Родитель
Сommit
d7249e1ff6

+ 4 - 1
app/controllers/blazer/queries_controller.rb

@@ -4,8 +4,11 @@ module Blazer
 
     def home
       set_queries(1000)
+
+      @dashboards = Blazer::Dashboard.order(:name)
+      @dashboards = @dashboards.includes(:creator) if Blazer.user_class
       @dashboards =
-        Blazer::Dashboard.order(:name).map do |d|
+        @dashboards.map do |d|
           {
             name: "<strong>#{view_context.link_to(d.name, d)}</strong>",
             creator: blazer_user && d.try(:creator) == blazer_user ? "You" : d.try(:creator).try(Blazer.user_name),

+ 1 - 0
app/models/blazer/check.rb

@@ -1,5 +1,6 @@
 module Blazer
   class Check < ActiveRecord::Base
+    belongs_to :creator, Blazer::BELONGS_TO_OPTIONAL.merge(class_name: Blazer.user_class.to_s) if Blazer.user_class
     belongs_to :query
 
     validates :query_id, presence: true

+ 1 - 0
app/models/blazer/dashboard.rb

@@ -1,5 +1,6 @@
 module Blazer
   class Dashboard < ActiveRecord::Base
+    belongs_to :creator, Blazer::BELONGS_TO_OPTIONAL.merge(class_name: Blazer.user_class.to_s) if Blazer.user_class
     has_many :dashboard_queries, dependent: :destroy
     has_many :queries, through: :dashboard_queries