Skip to content

Commit

Permalink
Updated a handful of files, removing everything extra/unnecessary. Up…
Browse files Browse the repository at this point in the history
…graded Rails to 2.1
  • Loading branch information
Joshua Clayton committed Jun 26, 2008
1 parent 33d80b2 commit 7d724e8
Show file tree
Hide file tree
Showing 1,039 changed files with 46,221 additions and 23,544 deletions.
81 changes: 67 additions & 14 deletions README
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
== Welcome to Rails

Rails is a web-application and persistence framework that includes everything
needed to create database-backed web-applications according to the
Model-View-Control pattern of separation. This pattern splits the view (also
called the presentation) into "dumb" templates that are primarily responsible
for inserting pre-built data in between HTML tags. The model contains the
"smart" domain objects (such as Account, Product, Person, Post) that holds all
the business logic and knows how to persist themselves to a database. The
controller handles the incoming requests (such as Save New Account, Update
Product, Show Post) by manipulating the model and directing data to the view.
Rails is a web-application framework that includes everything needed to create
database-backed web applications according to the Model-View-Control pattern.

This pattern splits the view (also called the presentation) into "dumb" templates
that are primarily responsible for inserting pre-built data in between HTML tags.
The model contains the "smart" domain objects (such as Account, Product, Person,
Post) that holds all the business logic and knows how to persist themselves to
a database. The controller handles the incoming requests (such as Save New Account,
Update Product, Show Post) by manipulating the model and directing data to the view.

In Rails, the model is handled by what's called an object-relational mapping
layer entitled Active Record. This layer allows you to present the data from
Expand All @@ -29,9 +29,8 @@ link:files/vendor/rails/actionpack/README.html.

1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
and your application name. Ex: rails myapp
(If you've downloaded Rails in a complete tgz or zip, this step is already done)
2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
3. Go to http://localhost:3000/ and get "Welcome aboard: Youre riding the Rails!"
3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
4. Follow the guidelines to start developing your application


Expand Down Expand Up @@ -62,6 +61,50 @@ Apache, LiteSpeed, IIS are just a few. For more information on FCGI,
please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI


== Apache .htaccess example

# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*
# RewriteRule .* - [L]

# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On

# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
# Alias /myrailsapp /path/to/myrailsapp/public
# RewriteBase /myrailsapp

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
#
# Example:
# ErrorDocument 500 /500.html

ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"


== Debugging Rails

Sometimes your application goes wrong. Fortunately there are a lot of tools that
Expand Down Expand Up @@ -102,7 +145,9 @@ and also on programming in general.

Debugger support is available through the debugger command when you start your Mongrel or
Webrick server with --debugger. This means that you can break out of execution at any point
in the code, investigate and change the model, AND then resume execution! Example:
in the code, investigate and change the model, AND then resume execution!
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Example:

class WeblogController < ActionController::Base
def index
Expand Down Expand Up @@ -140,6 +185,13 @@ Passing an argument will specify a different environment, like <tt>script/consol

To reload your controllers and models after launching the console run <tt>reload!</tt>

== dbconsole

You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
You would be connected to the database with the credentials defined in database.yml.
Starting the script without arguments will connect you to the development database. Passing an
argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
Currently works for mysql, postgresql and sqlite.

== Description of Contents

Expand All @@ -157,13 +209,13 @@ app/models

app/views
Holds the template files for the view that should be named like
weblogs/index.erb for the WeblogsController#index action. All views use eRuby
weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
syntax.

app/views/layouts
Holds the template files for layouts to be used with views. This models the common
header/footer method of wrapping views. In your views, define a layout using the
<tt>layout :default</tt> and create a file named default.erb. Inside default.erb,
<tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
call <% yield %> to render the view using this layout.

app/helpers
Expand Down Expand Up @@ -200,4 +252,5 @@ test

vendor
External libraries that the application depends on. Also includes the plugins subdirectory.
If the app has frozen rails, those gems also go here, under vendor/rails/.
This directory is in the load path.
4 changes: 0 additions & 4 deletions app/controllers/admin/base_controller.rb

This file was deleted.

41 changes: 0 additions & 41 deletions app/controllers/admin/feeds_controller.rb

This file was deleted.

27 changes: 0 additions & 27 deletions app/controllers/admin/users_controller.rb

This file was deleted.

7 changes: 1 addition & 6 deletions app/controllers/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ class LoggedExceptionsController < ActionController::Base

class ApplicationController < ActionController::Base
include ExceptionLoggable
# Be sure to include AuthenticationSystem in Application Controller instead
include AuthenticatedSystem

helper :all # include all helpers, all the time

# See ActionController::RequestForgeryProtection for details
# Uncomment the :secret if you're not using the cookie session store
protect_from_forgery :secret => '8230f0c5bfff1ff21ba21a229c1106c1'

BLUEPRINT_CONTENT_WIDTH = 24
BLUEPRINT_CONTENT_WIDTH = 24 unless defined? BLUEPRINT_CONTENT_WIDTH

before_filter :manage_page_title

Expand Down
2 changes: 0 additions & 2 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
class HomeController < ApplicationController
# caches_page :index

def index
dob = Date.parse("8/21/1983")
@age = Date.today.year - dob.year
Expand Down
24 changes: 0 additions & 24 deletions app/controllers/session_controller.rb

This file was deleted.

4 changes: 0 additions & 4 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ def extra_content(*args, &block)
content_builder(:extra_content, *(args + [:last]), &block)
end

def inline_form(&block)
content_builder(:inline_form, :eleven_twelfths, prepend_one_twentyfourth(), :last, :id => 'inline-form', &block)
end

private

def content_builder(area, *args, &block)
Expand Down
Loading

0 comments on commit 7d724e8

Please sign in to comment.