Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.88 KB | None | 0 0
  1.   def availability
  2.     # Disponibilità: 3 possiblità Available, NON Available (e se c'è una transazione visualizzare il nome del tenant
  3.     # Q4 2017 (cioè la data di disponibilità futura)
  4.     if super == :not_available
  5.       if SurfacesTrade.where(surface: object).any?
  6.         h.link_to SurfacesTrade.where(surface: object).first.trade.buyer.company_name, SurfacesTrade.where(surface: object).first.trade.buyer
  7.       else
  8.         super.text
  9.       end
  10.     elsif super == :available
  11.       unless (object.availability_since_year.nil? && object.availability_since_quarter.nil?)
  12.         unless (object.availability_since_year.empty? && object.availability_since_quarter.empty?)
  13.           "#{object.availability_since_quarter.capitalize} - #{object.availability_since_year}"
  14.         else
  15.           super.text
  16.         end
  17.       end
  18.     else
  19.       h.not_available
  20.     end
  21.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement