Skip to content

Instantly share code, notes, and snippets.

@dmclark
dmclark / gist:268021
Created January 3, 2010 16:25 — forked from gregelin/gist:176601
initial rails app creation
Creating a rails app "Vurl"
http://www.vimeo.com/3761040
(replace vurl with your appname, then Vurl is first model, too)
rails -d mysql vurl
cd vurl
git init
cat > .gitignore
log/*.log
ActionController::Routing::Routes.draw do |map|
map.login 'login', :controller => 'user_sessions', :action => 'new'
map.logout 'logout', :controller => 'user_sessions', :action => 'destroy'
map.resources :user_sessions
map.resources :users
map.resources :events
map.affiliates_list 'affiliates/list.:format', :controller => "affiliates", :action => "list"
map.connect 'affiliates/regenerate_thumb/:id', :controller => "affiliates", :action => "regenerate_thumb"
Last login: Sun Aug 29 13:14:28 on ttys000
dcimac-2:~ Administrator$ cd rails3/geoaccess
Changing into a directory with an untrusted .rvmrc
Do you wish to trust the rvmrc in this directory? It contains:
---
if [[ -n "$rvm_environments_path" && -s "$rvm_environments_path/ruby-1.9.2-head" ]] ; then
. "$rvm_environments_path/ruby-1.9.2-head"
else
rvm --create use "ruby-1.9.2-head"
Last login: Sun Aug 29 14:37:38 on ttys001
dcimac-2:~ Administrator$ cd rails3/sample
dcimac-2:sample Administrator$ rvm info
ruby-1.9.2-head:
system:
uname: "Darwin dcimac-2.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386 i386"
zsh: "zsh 4.3.9 (i386-apple-darwin10.0)"
bash: "GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
# == Schema Information
# Schema version: 20100906134036
#
# Table name: venues
#
# id :integer not null, primary key
# name :string(255)
# address :string(255)
# city :string(255)
# state :string(255)
$(document).ready(function() {
var latlng = new google.maps.LatLng(41.857476, -87.6205898);
var myOptions = {
zoom: <%= @zoom_level %>,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("showmap"),
myOptions);
var marker = new google.maps.Marker({
resources :directions
resources :neighborhoods
match '/neighborhood(/:neighborhood_name)', :to => "neighborhood#show", :as => :neighborhood
resources :venues
match '/about', :to => "pages#about"
match "/directions/:start/:destination" => 'directions#show', :as => :get_directions
class DirectionsController < ApplicationController
def new
@direction = Direction.new
@venues = Venue.all
end
def create
@direction = Direction.new(params[:direction])
if @direction.valid?
# TODO send direction here
<h1>Directions</h1>
<p>To go from <%= @start %> to <%= @destination %></p>
<ul>
<% @directions.xpath('//html_instructions').each do |step| %>
<li><%= step.text.html_safe %></li>
<% end %>
</ul>
class DirectionsController < ApplicationController
def new
@direction = Direction.new
@venues = Venue.all
end
def create
@direction = Direction.new(params[:direction])
if @direction.valid?
# TODO send direction here