Class: Guts::Site

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/guts/site.rb

Overview

Site model

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.current_idInteger

Note:

I simply can not see a better way at the moment to handle this with default_scope

Gets the current site ID

Returns:

  • (Integer)

    the ID



33
34
35
# File 'app/models/guts/site.rb', line 33

def self.current_id
  Thread.current[:site_id]
end

.current_id=(id) ⇒ Object

Note:

I simply can not see a better way at the moment to handle this with default_scope

Sets the current site ID

Parameters:

  • id (Integer)

    the ID to use



26
27
28
# File 'app/models/guts/site.rb', line 26

def self.current_id=(id)
  Thread.current[:site_id] = id
end

Instance Method Details

#default?Boolean

Checks if a site is default

Returns:

  • (Boolean)


19
20
21
# File 'app/models/guts/site.rb', line 19

def default?
  self[:default] == true
end