# -*- coding: utf-8 -*-
class LoginRoot < ActiveRecord::Base
  class << self
    def instance_method_already_implemented?(method_name)
      return true if method_name == 'connection'
      super
    end
  end
  alias_attribute :name, :loginroot
  establish_connection :request
  set_table_name "object"
  has_many :logins, :foreign_key => "loginroot"

  def self.offices
    offices = ["mtat4k1", ""]
    @login = LoginRoot.find(:all, :select => 'id, loginroot', :conditions => ['loginroot IN (?)', offices])
  end


  def full_address
    "г. Москва, " + Street.find_street(self.alias).to_s + " д." + house.to_s+" "+ building.to_s
  end

 end


