Skip to content

Instantly share code, notes, and snippets.

route_index GET /route(.:format) {:action=>"index", :controller=>"route"}
route_index POST /route(.:format) {:action=>"create", :controller=>"route"}
new_route GET /route/new(.:format) {:action=>"new", :controller=>"route"}
edit_route GET /route/:id/edit(.:format) {:action=>"edit", :controller=>"route"}
route GET /route/:id(.:format) {:action=>"show", :controller=>"route"}
route PUT /route/:id(.:format) {:action=>"update", :controller=>"route"}
route DELETE /route/:id(.:format) {:action=>"destroy", :controller=>"route"}
neighborhoods GET /neighborhoods(.:format) {:action=>"index", :controller=>"neighborhoods"}
neighborhoods POST /neighborhoods(.:format) {:action=>"create", :controller=>"neighborhoods"}
new_nei
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Action Controller: Exception caught</title>
<style>
body { background-color: #fff; color: #333; }
body, p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
Geoaccess::Application.routes.draw do
resources :routes
resources :neighborhoods
match '/neighborhood(/:neighborhood_name)', :to => "neighborhood#show", :as => :neighborhood
resources :venues
match '/about', :to => "pages#about"
<%= form_for @route, :html => {:method => :get}, :url => route_path, :remote => true do |f| -%>
<div class="field" style="float:left; padding-right:1em">
<%= f.label :startpoint_id %><br />
<%= f.select :startpoint_id, options_from_collection_for_select(@venues, 'id', 'name'), { :include_blank => false }, { :size => 15 } %>
</div>
<div class="field">
<%= f.label :endpoint_id %><br />
<%= f.select :endpoint_id, options_from_collection_for_select(@venues, 'id', 'name'), { :include_blank => false }, { :size => 15 } %>
</div>
<div class="field">
Started GET "/" for 127.0.0.1 at 2010-11-14 18:48:03 -0500
Processing by RoutesController#new as HTML
SQL (1.0ms) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"routes"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
def agent
agent = Mechanize.new { |a|
a.user_agent_alias = 'Mac Safari'
a.log = Logger.new('./site.log')
a.request_headers = {
"Referer" => "http://goroo.com/goroo/showTripPlanResults.htm",
"Origin" => "http://goroo.com/",
"X-Requested-With" => "XMLHttpRequest"
}
}
startpoint_id
ruby-1.9.2-p0 > r.directions
NoMethodError: undefined method `directions' for #<Route:0x000001016eb1b0>
from /Users/Administrator/.rvm/gems/ruby-1.9.2-p0@rails3/gems/activemodel-3.0.0/lib/active_model/attribute_methods.rb:364:in `method_missing'
from /Users/Administrator/.rvm/gems/ruby-1.9.2-p0@rails3/gems/activerecord-3.0.0/lib/active_record/attribute_methods.rb:46:in `method_missing'
from (irb):13
from /Users/Administrator/.rvm/gems/ruby-1.9.2-p0@rails3/gems/railties-3.0.0/lib/rails/commands/console.rb:44:in `start'
from /Users/Administrator/.rvm/gems/ruby-1.9.2-p0@rails3/gems/railties-3.0.0/lib/rails/commands/console.rb:8:in `start'
from /Users/Administrator/.rvm/gems/ruby-1.9.2-p0@rails3/gems/railties-3.0.0/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
class Route < ActiveRecord::Base
attr_accessor :startpaint_id, :endpaint_id, :directions
belongs_to :start, :class_name => "Venue", :foreign_key => "startpoint_id"
belongs_to :end, :class_name => "Venue", :foreign_key => "endpoint_id"
validates :startpoint_id, :presence => true
validates :endpoint_id, :presence => true
after_create :get_xml
$("#directions").update("<%= escape_javascript(render('directions')) %>")