Guest User

Untitled

a guest
Jul 18th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. class CreateTowers < ActiveRecord::Migration
  2. def self.up
  3. create_table :towers do |t|
  4. t.column :latitude, :float
  5. t.column :longitude, :float
  6. t.column :owner_name, :string, :limit=>200
  7. t.column :owner_address, :string, :limit=>35
  8. t.column :owner_city, :string, :limit=>20
  9. t.column :owner_state, :string, :limit=>2
  10. t.column :owner_zip, :string, :limit=>10
  11. t.column :address, :string, :limit=>80
  12. t.column :city, :string, :limit=>20
  13. t.column :state, :string, :limit=>2
  14. t.column :height, :float
  15. t.column :elevation, :float
  16. t.column :ohag, :float
  17. t.column :ohamsl, :float
  18. t.column :structure_type, :string, :limit=>6
  19. end
  20. add_index :towers, :state
  21. add_index :towers, :latitude
  22. add_index :towers, :longitude
  23. end
  24. def self.down
  25. drop_table :towers
  26. end
  27. end
  28.  
  29. class ChapSixController < ApplicationController
  30.  
  31. def map
  32. @towers = Tower.find :all,
  33. :conditions=>['state = ? AND latitude < ? AND longitude > ? AND latitude > ? AND longitude < ?','HI',20.40,-156.34,18.52,-154.67 ]
  34. @towers=@towers.collect{|t|t.attributes}
  35.  
  36. end
  37.  
  38. end
Add Comment
Please, Sign In to add comment