-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-do Getting Started application with Rails 4.
The sample application with the Getting Started Guide was very out of date. I've re-done it on edge (as of 51b9def) so it should be good to go with Rails 4. It's also in synch with what the guide actually says.
- Loading branch information
1 parent
51b9def
commit 2214237
Showing
76 changed files
with
404 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
# See http://help.github.com/ignore-files/ for more about ignoring files. | |||
# | |||
# If you find yourself ignoring temporary files generated by your text editor | |||
# or operating system, you probably want to add a global ignore instead: | |||
# git config --global core.excludesfile '~/.gitignore_global' | |||
|
|||
# Ignore bundler config. | |||
/.bundle | |||
|
|||
# Ignore the default SQLite database. | |||
/db/*.sqlite3 | |||
/db/*.sqlite3-journal | |||
|
|||
# Ignore all logfiles and tempfiles. | |||
/log/*.log | |||
/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,38 +1,38 @@ | |||
source 'https://rubygems.org' | source 'https://rubygems.org' | ||
|
|
||
gem 'rails', '3.2.3' | gem 'rails', '4.0.0' | ||
|
|||
# Bundle edge Rails instead: | |||
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |||
|
|
||
gem 'sqlite3' | gem 'sqlite3' | ||
|
|
||
|
|||
# Gems used only for assets and not required | # Gems used only for assets and not required | ||
# in production environments by default. | # in production environments by default. | ||
group :assets do | group :assets do | ||
gem 'sass-rails', '~> 3.2.3' | gem 'sprockets-rails' | ||
gem 'coffee-rails', '~> 3.2.1' | gem 'sass-rails' | ||
gem 'coffee-rails' | |||
|
|
||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes | # See https://github.com/sstephenson/execjs#readme for more supported runtimes | ||
# gem 'therubyracer', :platform => :ruby | # gem 'therubyracer', platforms: :ruby | ||
|
|
||
gem 'uglifier', '>= 1.0.3' | gem 'uglifier', '>= 1.0.3' | ||
end | end | ||
|
|
||
gem 'jquery-rails' | gem 'jquery-rails' | ||
|
|
||
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks | |||
gem 'turbolinks' | |||
|
|||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder | |||
gem 'jbuilder', '~> 1.0.1' | |||
|
|||
# To use ActiveModel has_secure_password | # To use ActiveModel has_secure_password | ||
# gem 'bcrypt-ruby', '~> 3.0.0' | # gem 'bcrypt-ruby', '~> 3.0.0' | ||
|
|
||
# To use Jbuilder templates for JSON | |||
# gem 'jbuilder' | |||
|
|||
# Use unicorn as the app server | # Use unicorn as the app server | ||
# gem 'unicorn' | # gem 'unicorn' | ||
|
|
||
# Deploy with Capistrano | # Deploy with Capistrano | ||
# gem 'capistrano' | # gem 'capistrano', group: :development | ||
|
|
||
# To use debugger | # To use debugger | ||
# gem 'debugger' | # gem 'debugger' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,150 @@ | |||
GIT | |||
remote: git://github.com/rails/activerecord-deprecated_finders.git | |||
revision: 2e7b35d7948cefb2bba96438873d7f7bb1961a03 | |||
specs: | |||
activerecord-deprecated_finders (0.0.2) | |||
|
|||
GIT | |||
remote: git://github.com/rails/arel.git | |||
revision: 38d0a222e275d917a2c1d093b24457bafb600a00 | |||
specs: | |||
arel (3.0.2.20120819075748) | |||
|
|||
GIT | |||
remote: git://github.com/rails/coffee-rails.git | |||
revision: 052634e6d02d4800d7b021201cc8d5829775b3cd | |||
specs: | |||
coffee-rails (4.0.0.beta) | |||
coffee-script (>= 2.2.0) | |||
railties (>= 4.0.0.beta, < 5.0) | |||
|
|||
GIT | |||
remote: git://github.com/rails/sass-rails.git | |||
revision: ae8138a89cac397c0df903dd533e2862902ce8f5 | |||
specs: | |||
sass-rails (4.0.0.beta) | |||
railties (>= 4.0.0.beta, < 5.0) | |||
sass (>= 3.1.10) | |||
sprockets-rails (~> 2.0.0.rc0) | |||
tilt (~> 1.3) | |||
|
|||
GIT | |||
remote: git://github.com/rails/sprockets-rails.git | |||
revision: 09917104fdb42245fe369612a7b0e3d77e1ba763 | |||
specs: | |||
sprockets-rails (2.0.0.rc1) | |||
actionpack (>= 3.0) | |||
activesupport (>= 3.0) | |||
sprockets (~> 2.8) | |||
|
|||
PATH | |||
remote: /Users/steve/src/rails | |||
specs: | |||
actionmailer (4.0.0.beta) | |||
actionpack (= 4.0.0.beta) | |||
mail (~> 2.5.3) | |||
actionpack (4.0.0.beta) | |||
activesupport (= 4.0.0.beta) | |||
builder (~> 3.1.0) | |||
erubis (~> 2.7.0) | |||
rack (~> 1.4.3) | |||
rack-test (~> 0.6.1) | |||
activemodel (4.0.0.beta) | |||
activesupport (= 4.0.0.beta) | |||
builder (~> 3.1.0) | |||
activerecord (4.0.0.beta) | |||
activemodel (= 4.0.0.beta) | |||
activerecord-deprecated_finders (= 0.0.2) | |||
activesupport (= 4.0.0.beta) | |||
arel (~> 3.0.2) | |||
activesupport (4.0.0.beta) | |||
i18n (~> 0.6) | |||
minitest (~> 4.1) | |||
multi_json (~> 1.3) | |||
thread_safe (~> 0.1) | |||
tzinfo (~> 0.3.33) | |||
rails (4.0.0.beta) | |||
actionmailer (= 4.0.0.beta) | |||
actionpack (= 4.0.0.beta) | |||
activerecord (= 4.0.0.beta) | |||
activesupport (= 4.0.0.beta) | |||
bundler (>= 1.2.2, < 2.0) | |||
railties (= 4.0.0.beta) | |||
sprockets-rails (~> 2.0.0.rc1) | |||
railties (4.0.0.beta) | |||
actionpack (= 4.0.0.beta) | |||
activesupport (= 4.0.0.beta) | |||
rake (>= 0.8.7) | |||
rdoc (~> 3.4) | |||
thor (>= 0.15.4, < 2.0) | |||
|
|||
GEM | |||
remote: https://rubygems.org/ | |||
specs: | |||
atomic (1.0.1) | |||
builder (3.1.4) | |||
coffee-script (2.2.0) | |||
coffee-script-source | |||
execjs | |||
coffee-script-source (1.4.0) | |||
erubis (2.7.0) | |||
execjs (1.4.0) | |||
multi_json (~> 1.0) | |||
hike (1.2.1) | |||
i18n (0.6.1) | |||
jbuilder (1.0.2) | |||
activesupport (>= 3.0.0) | |||
jquery-rails (2.2.0) | |||
railties (>= 3.0, < 5.0) | |||
thor (>= 0.14, < 2.0) | |||
json (1.7.6) | |||
mail (2.5.3) | |||
i18n (>= 0.4.0) | |||
mime-types (~> 1.16) | |||
treetop (~> 1.4.8) | |||
mime-types (1.19) | |||
minitest (4.4.0) | |||
multi_json (1.5.0) | |||
polyglot (0.3.3) | |||
rack (1.4.4) | |||
rack-test (0.6.2) | |||
rack (>= 1.0) | |||
rake (10.0.3) | |||
rdoc (3.12) | |||
json (~> 1.4) | |||
sass (3.2.5) | |||
sprockets (2.8.2) | |||
hike (~> 1.2) | |||
multi_json (~> 1.0) | |||
rack (~> 1.0) | |||
tilt (~> 1.1, != 1.3.0) | |||
sqlite3 (1.3.7) | |||
thor (0.16.0) | |||
thread_safe (0.1.0) | |||
atomic | |||
tilt (1.3.3) | |||
treetop (1.4.12) | |||
polyglot | |||
polyglot (>= 0.3.1) | |||
turbolinks (1.0.0) | |||
coffee-rails | |||
tzinfo (0.3.35) | |||
uglifier (1.3.0) | |||
execjs (>= 0.3.0) | |||
multi_json (~> 1.0, >= 1.0.2) | |||
|
|||
PLATFORMS | |||
ruby | |||
|
|||
DEPENDENCIES | |||
activerecord-deprecated_finders! | |||
arel! | |||
coffee-rails! | |||
jbuilder (~> 1.0.1) | |||
jquery-rails | |||
rails! | |||
sass-rails! | |||
sprockets-rails! | |||
sqlite3 | |||
turbolinks | |||
uglifier (>= 1.0.3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
guides/code/getting_started/app/assets/javascripts/comments.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
# Place all the behaviors and hooks related to the matching controller here. | |||
# All this logic will automatically be available in application.js. | |||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
3 changes: 3 additions & 0 deletions
3
guides/code/getting_started/app/assets/javascripts/posts.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
# Place all the behaviors and hooks related to the matching controller here. | |||
# All this logic will automatically be available in application.js. | |||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
3 changes: 3 additions & 0 deletions
3
guides/code/getting_started/app/assets/javascripts/welcome.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
# Place all the behaviors and hooks related to the matching controller here. | |||
# All this logic will automatically be available in application.js. | |||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -10,4 +10,4 @@ | ||
* | * | ||
*= require_self | *= require_self | ||
*= require_tree . | *= require_tree . | ||
*/ | */ |
3 changes: 3 additions & 0 deletions
3
guides/code/getting_started/app/assets/stylesheets/comments.css.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
// Place all the styles related to the Comments controller here. | |||
// They will automatically be included in application.css. | |||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
3 changes: 3 additions & 0 deletions
3
guides/code/getting_started/app/assets/stylesheets/posts.css.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
// Place all the styles related to the posts controller here. | |||
// They will automatically be included in application.css. | |||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
3 changes: 3 additions & 0 deletions
3
guides/code/getting_started/app/assets/stylesheets/welcome.css.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
// Place all the styles related to the welcome controller here. | |||
// They will automatically be included in application.css. | |||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
4 changes: 3 additions & 1 deletion
4
guides/code/getting_started/app/controllers/application_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,5 @@ | |||
class ApplicationController < ActionController::Base | class ApplicationController < ActionController::Base | ||
protect_from_forgery | # Prevent CSRF attacks by raising an exception. | ||
# For APIs, you may want to use :null_session instead. | |||
protect_from_forgery with: :exception | |||
end | end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,6 +1,7 @@ | |||
class Post < ActiveRecord::Base | class Post < ActiveRecord::Base | ||
validates :title, :presence => true, | has_many :comments, dependent: :destroy | ||
:length => { :minimum => 5 } |
|
||
|
validates :title, | ||
has_many :comments, :dependent => :destroy | presence: true, | ||
length: { minimum: 5 } | |||
end | end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
2214237
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good job