Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create
- begin
- @link = Link.find(params[:id])
- @outlet = Outlet.find(@link.outlet.id)
- @address= @outlet.address
- @floorplan = Floorplan.find_by_floor_id_and_is_active(@address.floor,true)
- if @floorplan.nil?
- render :action => :upload
- else
- @all_outlets = Outlet.find_all_by_address_id(@address)
- @Coords, @unplaced_outlets = @all_outlets.partition(&:x)
- @temp = Address.find_all_by_floor_id(@address.floor_id)
- rooms = {}
- for r in @temp
- rooms[r] = Room.find(r.room_id).name
- end
- @rooms = rooms.values
- @rooms = @rooms.sort
- @ports = {}
- @switches = {}
- for o in @Coords
- link = Link.find_by_outlet_id(o.id)
- unless link.nil?
- @ports[o] = Port.find(link.port_id)
- @switches[o] = Switch.find(@ports[o].switch_id)
- end
- end
- render :action => :index
- end
- rescue Exception #exception, probably caused by attempting to view a floorplan other than from the search results button
- flash[:notice] = "Error viewing floorplan. redirected to search results"
- redirect_to :controller => search, :action => :new
- end
- end
Add Comment
Please, Sign In to add comment