Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

automatic import from ryanb/railscasts-episodes

  • Loading branch information...
commit af55ae809c77c3cc5ef6610bf53cb3f45763f29f 0 parents
Giles gilesbowkett authored

Showing 90 changed files with 10,975 additions and 0 deletions. Show diff stats Hide diff stats

  1. +9 0 README
  2. +4 0 todo/.gitignore
  3. +8 0 todo/Gemfile
  4. +131 0 todo/Gemfile.lock
  5. +256 0 todo/README
  6. +7 0 todo/Rakefile
  7. +3 0  todo/app/controllers/application_controller.rb
  8. +19 0 todo/app/controllers/authentications_controller.rb
  9. +44 0 todo/app/controllers/projects_controller.rb
  10. +36 0 todo/app/controllers/tasks_controller.rb
  11. +2 0  todo/app/helpers/application_helper.rb
  12. +2 0  todo/app/helpers/authentications_helper.rb
  13. +23 0 todo/app/helpers/error_messages_helper.rb
  14. +22 0 todo/app/helpers/layout_helper.rb
  15. +2 0  todo/app/helpers/projects_helper.rb
  16. +2 0  todo/app/helpers/tasks_helper.rb
  17. +3 0  todo/app/models/authentication.rb
  18. +4 0 todo/app/models/project.rb
  19. +4 0 todo/app/models/task.rb
  20. +11 0 todo/app/models/user.rb
  21. +39 0 todo/app/views/authentications/index.html.erb
  22. +27 0 todo/app/views/layouts/application.html.erb
  23. +8 0 todo/app/views/projects/_form.html.erb
  24. +8 0 todo/app/views/projects/edit.html.erb
  25. +16 0 todo/app/views/projects/index.html.erb
  26. +5 0 todo/app/views/projects/new.html.erb
  27. +17 0 todo/app/views/projects/show.html.erb
  28. +13 0 todo/app/views/tasks/_form.html.erb
  29. +4 0 todo/app/views/tasks/edit.html.erb
  30. +4 0 todo/app/views/tasks/new.html.erb
  31. +4 0 todo/config.ru
  32. +42 0 todo/config/application.rb
  33. +13 0 todo/config/boot.rb
  34. +22 0 todo/config/database.yml
  35. +5 0 todo/config/environment.rb
  36. +27 0 todo/config/environments/development.rb
  37. +49 0 todo/config/environments/production.rb
  38. +35 0 todo/config/environments/test.rb
  39. +7 0 todo/config/initializers/backtrace_silencers.rb
  40. +142 0 todo/config/initializers/devise.rb
  41. +10 0 todo/config/initializers/inflections.rb
  42. +5 0 todo/config/initializers/mime_types.rb
  43. +3 0  todo/config/initializers/omniauth.rb
  44. +7 0 todo/config/initializers/secret_token.rb
  45. +8 0 todo/config/initializers/session_store.rb
  46. +39 0 todo/config/locales/devise.en.yml
  47. +5 0 todo/config/locales/en.yml
  48. +8 0 todo/config/routes.rb
  49. +12 0 todo/db/migrate/20100927035419_create_projects.rb
  50. +14 0 todo/db/migrate/20100927035455_create_tasks.rb
  51. +26 0 todo/db/migrate/20100927035705_devise_create_users.rb
  52. +14 0 todo/db/migrate/20101011050048_create_authentications.rb
  53. +56 0 todo/db/schema.rb
  54. +7 0 todo/db/seeds.rb
  55. +2 0  todo/doc/README_FOR_APP
  56. 0  todo/lib/tasks/.gitkeep
  57. +26 0 todo/public/404.html
  58. +26 0 todo/public/422.html
  59. +26 0 todo/public/500.html
  60. 0  todo/public/favicon.ico
  61. BIN  todo/public/images/facebook_64.png
  62. BIN  todo/public/images/google_64.png
  63. BIN  todo/public/images/openid_64.png
  64. BIN  todo/public/images/rails.png
  65. BIN  todo/public/images/twitter_32.png
  66. BIN  todo/public/images/twitter_64.png
  67. +2 0  todo/public/javascripts/application.js
  68. +965 0 todo/public/javascripts/controls.js
  69. +974 0 todo/public/javascripts/dragdrop.js
  70. +1,123 0 todo/public/javascripts/effects.js
  71. +6,001 0 todo/public/javascripts/prototype.js
  72. +175 0 todo/public/javascripts/rails.js
  73. +5 0 todo/public/robots.txt
  74. 0  todo/public/stylesheets/.gitkeep
  75. +141 0 todo/public/stylesheets/application.css
  76. +6 0 todo/script/rails
  77. +9 0 todo/test/fixtures/authentications.yml
  78. +5 0 todo/test/fixtures/projects.yml
  79. +9 0 todo/test/fixtures/tasks.yml
  80. +11 0 todo/test/fixtures/users.yml
  81. +27 0 todo/test/functional/authentications_controller_test.rb
  82. +54 0 todo/test/functional/projects_controller_test.rb
  83. +44 0 todo/test/functional/tasks_controller_test.rb
  84. +9 0 todo/test/performance/browsing_test.rb
  85. +13 0 todo/test/test_helper.rb
  86. +7 0 todo/test/unit/authentication_test.rb
  87. +7 0 todo/test/unit/project_test.rb
  88. +7 0 todo/test/unit/task_test.rb
  89. +8 0 todo/test/unit/user_test.rb
  90. 0  todo/vendor/plugins/.gitkeep
9 README
... ... @@ -0,0 +1,9 @@
  1 +Railscasts Episode #235: OmniAuth Part 1
  2 +
  3 +http://railscasts.com/episodes/235
  4 +
  5 +Commands
  6 +
  7 + bundle install
  8 + rails g nifty:scaffold authentication user_id:integer provider:string uid:string index create destroy
  9 + rake db:migrate
4 todo/.gitignore
... ... @@ -0,0 +1,4 @@
  1 +.bundle
  2 +db/*.sqlite3
  3 +log/*.log
  4 +tmp/**/*
8 todo/Gemfile
... ... @@ -0,0 +1,8 @@
  1 +source 'http://rubygems.org'
  2 +
  3 +gem 'rails', '3.0.0'
  4 +
  5 +gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
  6 +gem 'devise'
  7 +gem 'nifty-generators'
  8 +gem 'omniauth'
131 todo/Gemfile.lock
... ... @@ -0,0 +1,131 @@
  1 +GEM
  2 + remote: http://rubygems.org/
  3 + specs:
  4 + abstract (1.0.0)
  5 + actionmailer (3.0.0)
  6 + actionpack (= 3.0.0)
  7 + mail (~> 2.2.5)
  8 + actionpack (3.0.0)
  9 + activemodel (= 3.0.0)
  10 + activesupport (= 3.0.0)
  11 + builder (~> 2.1.2)
  12 + erubis (~> 2.6.6)
  13 + i18n (~> 0.4.1)
  14 + rack (~> 1.2.1)
  15 + rack-mount (~> 0.6.12)
  16 + rack-test (~> 0.5.4)
  17 + tzinfo (~> 0.3.23)
  18 + activemodel (3.0.0)
  19 + activesupport (= 3.0.0)
  20 + builder (~> 2.1.2)
  21 + i18n (~> 0.4.1)
  22 + activerecord (3.0.0)
  23 + activemodel (= 3.0.0)
  24 + activesupport (= 3.0.0)
  25 + arel (~> 1.0.0)
  26 + tzinfo (~> 0.3.23)
  27 + activeresource (3.0.0)
  28 + activemodel (= 3.0.0)
  29 + activesupport (= 3.0.0)
  30 + activesupport (3.0.0)
  31 + addressable (2.2.1)
  32 + arel (1.0.1)
  33 + activesupport (~> 3.0.0)
  34 + bcrypt-ruby (2.1.2)
  35 + builder (2.1.2)
  36 + devise (1.1.3)
  37 + bcrypt-ruby (~> 2.1.2)
  38 + warden (~> 0.10.7)
  39 + erubis (2.6.6)
  40 + abstract (>= 1.0.0)
  41 + faraday (0.4.6)
  42 + addressable (>= 2.1.1)
  43 + rack (>= 1.0.1)
  44 + i18n (0.4.1)
  45 + mail (2.2.6.1)
  46 + activesupport (>= 2.3.6)
  47 + mime-types
  48 + treetop (>= 1.4.5)
  49 + mime-types (1.16)
  50 + multi_json (0.0.4)
  51 + net-ldap (0.1.1)
  52 + nifty-generators (0.4.1)
  53 + nokogiri (1.4.3.1)
  54 + oa-basic (0.1.2)
  55 + multi_json (~> 0.0.2)
  56 + nokogiri (~> 1.4.2)
  57 + oa-core (= 0.1.2)
  58 + rest-client (~> 1.6.0)
  59 + oa-core (0.1.2)
  60 + rack (~> 1.1)
  61 + oa-enterprise (0.1.2)
  62 + net-ldap (~> 0.1.1)
  63 + nokogiri (~> 1.4.2)
  64 + oa-core (= 0.1.2)
  65 + rubyntlm (~> 0.1.1)
  66 + oa-oauth (0.1.2)
  67 + multi_json (~> 0.0.2)
  68 + nokogiri (~> 1.4.2)
  69 + oa-core (= 0.1.2)
  70 + oauth (~> 0.4.0)
  71 + oauth2 (~> 0.0.10)
  72 + oa-openid (0.1.2)
  73 + oa-core (= 0.1.2)
  74 + rack-openid (~> 1.1.1)
  75 + ruby-openid-apps-discovery
  76 + oauth (0.4.3)
  77 + oauth2 (0.0.13)
  78 + faraday (~> 0.4.1)
  79 + multi_json (>= 0.0.4)
  80 + omniauth (0.1.2)
  81 + oa-basic (= 0.1.2)
  82 + oa-core (= 0.1.2)
  83 + oa-enterprise (= 0.1.2)
  84 + oa-oauth (= 0.1.2)
  85 + oa-openid (= 0.1.2)
  86 + polyglot (0.3.1)
  87 + rack (1.2.1)
  88 + rack-mount (0.6.13)
  89 + rack (>= 1.0.0)
  90 + rack-openid (1.1.2)
  91 + rack (>= 0.4)
  92 + ruby-openid (>= 2.0.3)
  93 + rack-test (0.5.6)
  94 + rack (>= 1.0)
  95 + rails (3.0.0)
  96 + actionmailer (= 3.0.0)
  97 + actionpack (= 3.0.0)
  98 + activerecord (= 3.0.0)
  99 + activeresource (= 3.0.0)
  100 + activesupport (= 3.0.0)
  101 + bundler (~> 1.0.0)
  102 + railties (= 3.0.0)
  103 + railties (3.0.0)
  104 + actionpack (= 3.0.0)
  105 + activesupport (= 3.0.0)
  106 + rake (>= 0.8.4)
  107 + thor (~> 0.14.0)
  108 + rake (0.8.7)
  109 + rest-client (1.6.1)
  110 + mime-types (>= 1.16)
  111 + ruby-openid (2.1.8)
  112 + ruby-openid-apps-discovery (1.2.0)
  113 + ruby-openid (>= 2.1.7)
  114 + rubyntlm (0.1.1)
  115 + sqlite3-ruby (1.2.5)
  116 + thor (0.14.2)
  117 + treetop (1.4.8)
  118 + polyglot (>= 0.3.1)
  119 + tzinfo (0.3.23)
  120 + warden (0.10.7)
  121 + rack (>= 1.0.0)
  122 +
  123 +PLATFORMS
  124 + ruby
  125 +
  126 +DEPENDENCIES
  127 + devise
  128 + nifty-generators
  129 + omniauth
  130 + rails (= 3.0.0)
  131 + sqlite3-ruby (= 1.2.5)
256 todo/README
... ... @@ -0,0 +1,256 @@
  1 +== Welcome to Rails
  2 +
  3 +Rails is a web-application framework that includes everything needed to create
  4 +database-backed web applications according to the Model-View-Control pattern.
  5 +
  6 +This pattern splits the view (also called the presentation) into "dumb"
  7 +templates that are primarily responsible for inserting pre-built data in between
  8 +HTML tags. The model contains the "smart" domain objects (such as Account,
  9 +Product, Person, Post) that holds all the business logic and knows how to
  10 +persist themselves to a database. The controller handles the incoming requests
  11 +(such as Save New Account, Update Product, Show Post) by manipulating the model
  12 +and directing data to the view.
  13 +
  14 +In Rails, the model is handled by what's called an object-relational mapping
  15 +layer entitled Active Record. This layer allows you to present the data from
  16 +database rows as objects and embellish these data objects with business logic
  17 +methods. You can read more about Active Record in
  18 +link:files/vendor/rails/activerecord/README.html.
  19 +
  20 +The controller and view are handled by the Action Pack, which handles both
  21 +layers by its two parts: Action View and Action Controller. These two layers
  22 +are bundled in a single package due to their heavy interdependence. This is
  23 +unlike the relationship between the Active Record and Action Pack that is much
  24 +more separate. Each of these packages can be used independently outside of
  25 +Rails. You can read more about Action Pack in
  26 +link:files/vendor/rails/actionpack/README.html.
  27 +
  28 +
  29 +== Getting Started
  30 +
  31 +1. At the command prompt, create a new Rails application:
  32 + <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
  33 +
  34 +2. Change directory to <tt>myapp</tt> and start the web server:
  35 + <tt>cd myapp; rails server</tt> (run with --help for options)
  36 +
  37 +3. Go to http://localhost:3000/ and you'll see:
  38 + "Welcome aboard: You're riding Ruby on Rails!"
  39 +
  40 +4. Follow the guidelines to start developing your application. You can find
  41 +the following resources handy:
  42 +
  43 +* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
  44 +* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
  45 +
  46 +
  47 +== Debugging Rails
  48 +
  49 +Sometimes your application goes wrong. Fortunately there are a lot of tools that
  50 +will help you debug it and get it back on the rails.
  51 +
  52 +First area to check is the application log files. Have "tail -f" commands
  53 +running on the server.log and development.log. Rails will automatically display
  54 +debugging and runtime information to these files. Debugging info will also be
  55 +shown in the browser on requests from 127.0.0.1.
  56 +
  57 +You can also log your own messages directly into the log file from your code
  58 +using the Ruby logger class from inside your controllers. Example:
  59 +
  60 + class WeblogController < ActionController::Base
  61 + def destroy
  62 + @weblog = Weblog.find(params[:id])
  63 + @weblog.destroy
  64 + logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
  65 + end
  66 + end
  67 +
  68 +The result will be a message in your log file along the lines of:
  69 +
  70 + Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
  71 +
  72 +More information on how to use the logger is at http://www.ruby-doc.org/core/
  73 +
  74 +Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
  75 +several books available online as well:
  76 +
  77 +* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
  78 +* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
  79 +
  80 +These two books will bring you up to speed on the Ruby language and also on
  81 +programming in general.
  82 +
  83 +
  84 +== Debugger
  85 +
  86 +Debugger support is available through the debugger command when you start your
  87 +Mongrel or WEBrick server with --debugger. This means that you can break out of
  88 +execution at any point in the code, investigate and change the model, and then,
  89 +resume execution! You need to install ruby-debug to run the server in debugging
  90 +mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
  91 +
  92 + class WeblogController < ActionController::Base
  93 + def index
  94 + @posts = Post.find(:all)
  95 + debugger
  96 + end
  97 + end
  98 +
  99 +So the controller will accept the action, run the first line, then present you
  100 +with a IRB prompt in the server window. Here you can do things like:
  101 +
  102 + >> @posts.inspect
  103 + => "[#<Post:0x14a6be8
  104 + @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
  105 + #<Post:0x14a6620
  106 + @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
  107 + >> @posts.first.title = "hello from a debugger"
  108 + => "hello from a debugger"
  109 +
  110 +...and even better, you can examine how your runtime objects actually work:
  111 +
  112 + >> f = @posts.first
  113 + => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
  114 + >> f.
  115 + Display all 152 possibilities? (y or n)
  116 +
  117 +Finally, when you're ready to resume execution, you can enter "cont".
  118 +
  119 +
  120 +== Console
  121 +
  122 +The console is a Ruby shell, which allows you to interact with your
  123 +application's domain model. Here you'll have all parts of the application
  124 +configured, just like it is when the application is running. You can inspect
  125 +domain models, change values, and save to the database. Starting the script
  126 +without arguments will launch it in the development environment.
  127 +
  128 +To start the console, run <tt>rails console</tt> from the application
  129 +directory.
  130 +
  131 +Options:
  132 +
  133 +* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
  134 + made to the database.
  135 +* Passing an environment name as an argument will load the corresponding
  136 + environment. Example: <tt>rails console production</tt>.
  137 +
  138 +To reload your controllers and models after launching the console run
  139 +<tt>reload!</tt>
  140 +
  141 +More information about irb can be found at:
  142 +link:http://www.rubycentral.com/pickaxe/irb.html
  143 +
  144 +
  145 +== dbconsole
  146 +
  147 +You can go to the command line of your database directly through <tt>rails
  148 +dbconsole</tt>. You would be connected to the database with the credentials
  149 +defined in database.yml. Starting the script without arguments will connect you
  150 +to the development database. Passing an argument will connect you to a different
  151 +database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
  152 +PostgreSQL and SQLite 3.
  153 +
  154 +== Description of Contents
  155 +
  156 +The default directory structure of a generated Ruby on Rails application:
  157 +
  158 + |-- app
  159 + | |-- controllers
  160 + | |-- helpers
  161 + | |-- models
  162 + | `-- views
  163 + | `-- layouts
  164 + |-- config
  165 + | |-- environments
  166 + | |-- initializers
  167 + | `-- locales
  168 + |-- db
  169 + |-- doc
  170 + |-- lib
  171 + | `-- tasks
  172 + |-- log
  173 + |-- public
  174 + | |-- images
  175 + | |-- javascripts
  176 + | `-- stylesheets
  177 + |-- script
  178 + | `-- performance
  179 + |-- test
  180 + | |-- fixtures
  181 + | |-- functional
  182 + | |-- integration
  183 + | |-- performance
  184 + | `-- unit
  185 + |-- tmp
  186 + | |-- cache
  187 + | |-- pids
  188 + | |-- sessions
  189 + | `-- sockets
  190 + `-- vendor
  191 + `-- plugins
  192 +
  193 +app
  194 + Holds all the code that's specific to this particular application.
  195 +
  196 +app/controllers
  197 + Holds controllers that should be named like weblogs_controller.rb for
  198 + automated URL mapping. All controllers should descend from
  199 + ApplicationController which itself descends from ActionController::Base.
  200 +
  201 +app/models
  202 + Holds models that should be named like post.rb. Models descend from
  203 + ActiveRecord::Base by default.
  204 +
  205 +app/views
  206 + Holds the template files for the view that should be named like
  207 + weblogs/index.html.erb for the WeblogsController#index action. All views use
  208 + eRuby syntax by default.
  209 +
  210 +app/views/layouts
  211 + Holds the template files for layouts to be used with views. This models the
  212 + common header/footer method of wrapping views. In your views, define a layout
  213 + using the <tt>layout :default</tt> and create a file named default.html.erb.
  214 + Inside default.html.erb, call <% yield %> to render the view using this
  215 + layout.
  216 +
  217 +app/helpers
  218 + Holds view helpers that should be named like weblogs_helper.rb. These are
  219 + generated for you automatically when using generators for controllers.
  220 + Helpers can be used to wrap functionality for your views into methods.
  221 +
  222 +config
  223 + Configuration files for the Rails environment, the routing map, the database,
  224 + and other dependencies.
  225 +
  226 +db
  227 + Contains the database schema in schema.rb. db/migrate contains all the
  228 + sequence of Migrations for your schema.
  229 +
  230 +doc
  231 + This directory is where your application documentation will be stored when
  232 + generated using <tt>rake doc:app</tt>
  233 +
  234 +lib
  235 + Application specific libraries. Basically, any kind of custom code that
  236 + doesn't belong under controllers, models, or helpers. This directory is in
  237 + the load path.
  238 +
  239 +public
  240 + The directory available for the web server. Contains subdirectories for
  241 + images, stylesheets, and javascripts. Also contains the dispatchers and the
  242 + default HTML files. This should be set as the DOCUMENT_ROOT of your web
  243 + server.
  244 +
  245 +script
  246 + Helper scripts for automation and generation.
  247 +
  248 +test
  249 + Unit and functional tests along with fixtures. When using the rails generate
  250 + command, template test files will be generated for you and placed in this
  251 + directory.
  252 +
  253 +vendor
  254 + External libraries that the application depends on. Also includes the plugins
  255 + subdirectory. If the app has frozen rails, those gems also go here, under
  256 + vendor/rails/. This directory is in the load path.
7 todo/Rakefile
... ... @@ -0,0 +1,7 @@
  1 +# Add your own tasks in files placed in lib/tasks ending in .rake,
  2 +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
  3 +
  4 +require File.expand_path('../config/application', __FILE__)
  5 +require 'rake'
  6 +
  7 +Todo::Application.load_tasks
3  todo/app/controllers/application_controller.rb
... ... @@ -0,0 +1,3 @@
  1 +class ApplicationController < ActionController::Base
  2 + protect_from_forgery
  3 +end
19 todo/app/controllers/authentications_controller.rb
... ... @@ -0,0 +1,19 @@
  1 +class AuthenticationsController < ApplicationController
  2 + def index
  3 + @authentications = current_user.authentications if current_user
  4 + end
  5 +
  6 + def create
  7 + auth = request.env["rack.auth"]
  8 + current_user.authentications.find_or_create_by_provider_and_uid(auth['provider'], auth['uid'])
  9 + flash[:notice] = "Authentication successful."
  10 + redirect_to authentications_url
  11 + end
  12 +
  13 + def destroy
  14 + @authentication = current_user.authentications.find(params[:id])
  15 + @authentication.destroy
  16 + flash[:notice] = "Successfully destroyed authentication."
  17 + redirect_to authentications_url
  18 + end
  19 +end
44 todo/app/controllers/projects_controller.rb
... ... @@ -0,0 +1,44 @@
  1 +class ProjectsController < ApplicationController
  2 + def index
  3 + @projects = Project.all
  4 + end
  5 +
  6 + def show
  7 + @project = Project.find(params[:id])
  8 + end
  9 +
  10 + def new
  11 + @project = Project.new
  12 + end
  13 +
  14 + def create
  15 + @project = Project.new(params[:project])
  16 + if @project.save
  17 + flash[:notice] = "Successfully created project."
  18 + redirect_to @project
  19 + else
  20 + render :action => 'new'
  21 + end
  22 + end
  23 +
  24 + def edit
  25 + @project = Project.find(params[:id])
  26 + end
  27 +
  28 + def update
  29 + @project = Project.find(params[:id])
  30 + if @project.update_attributes(params[:project])
  31 + flash[:notice] = "Successfully updated project."
  32 + redirect_to @project
  33 + else
  34 + render :action => 'edit'
  35 + end
  36 + end
  37 +
  38 + def destroy
  39 + @project = Project.find(params[:id])
  40 + @project.destroy
  41 + flash[:notice] = "Successfully destroyed project."
  42 + redirect_to projects_url
  43 + end
  44 +end
36 todo/app/controllers/tasks_controller.rb
... ... @@ -0,0 +1,36 @@
  1 +class TasksController < ApplicationController
  2 + def new
  3 + @task = Task.new(:project_id => params[:project_id])
  4 + end
  5 +
  6 + def create
  7 + @task = Task.new(params[:task])
  8 + if @task.save
  9 + flash[:notice] = "Successfully created task."
  10 + redirect_to @task.project
  11 + else
  12 + render :action => 'new'
  13 + end
  14 + end
  15 +
  16 + def edit
  17 + @task = Task.find(params[:id])
  18 + end
  19 +
  20 + def update
  21 + @task = Task.find(params[:id])
  22 + if @task.update_attributes(params[:task])
  23 + flash[:notice] = "Successfully updated task."
  24 + redirect_to @task.project
  25 + else
  26 + render :action => 'edit'
  27 + end
  28 + end
  29 +
  30 + def destroy
  31 + @task = Task.find(params[:id])
  32 + @task.destroy
  33 + flash[:notice] = "Successfully destroyed task."
  34 + redirect_to @task.project
  35 + end
  36 +end
2  todo/app/helpers/application_helper.rb
... ... @@ -0,0 +1,2 @@
  1 +module ApplicationHelper
  2 +end
2  todo/app/helpers/authentications_helper.rb
... ... @@ -0,0 +1,2 @@
  1 +module AuthenticationsHelper
  2 +end
23 todo/app/helpers/error_messages_helper.rb
... ... @@ -0,0 +1,23 @@
  1 +module ErrorMessagesHelper
  2 + # Render error messages for the given objects. The :message and :header_message options are allowed.
  3 + def error_messages_for(*objects)
  4 + options = objects.extract_options!
  5 + options[:header_message] ||= "Invalid Fields"
  6 + options[:message] ||= "Correct the following errors and try again."
  7 + messages = objects.compact.map { |o| o.errors.full_messages }.flatten
  8 + unless messages.empty?
  9 + content_tag(:div, :class => "error_messages") do
  10 + list_items = messages.map { |msg| content_tag(:li, msg) }
  11 + content_tag(:h2, options[:header_message]) + content_tag(:p, options[:message]) + content_tag(:ul, list_items.join.html_safe)
  12 + end
  13 + end
  14 + end
  15 +
  16 + module FormBuilderAdditions
  17 + def error_messages(options = {})
  18 + @template.error_messages_for(@object, options)
  19 + end
  20 + end
  21 +end
  22 +
  23 +ActionView::Helpers::FormBuilder.send(:include, ErrorMessagesHelper::FormBuilderAdditions)
22 todo/app/helpers/layout_helper.rb
... ... @@ -0,0 +1,22 @@
  1 +# These helper methods can be called in your template to set variables to be used in the layout
  2 +# This module should be included in all views globally,
  3 +# to do so you may need to add this line to your ApplicationController
  4 +# helper :layout
  5 +module LayoutHelper
  6 + def title(page_title, show_title = true)
  7 + content_for(:title) { page_title.to_s }
  8 + @show_title = show_title
  9 + end
  10 +
  11 + def show_title?
  12 + @show_title
  13 + end
  14 +
  15 + def stylesheet(*args)
  16 + content_for(:head) { stylesheet_link_tag(*args) }
  17 + end
  18 +
  19 + def javascript(*args)
  20 + content_for(:head) { javascript_include_tag(*args) }
  21 + end
  22 +end
2  todo/app/helpers/projects_helper.rb
... ... @@ -0,0 +1,2 @@
  1 +module ProjectsHelper
  2 +end
2  todo/app/helpers/tasks_helper.rb
... ... @@ -0,0 +1,2 @@
  1 +module TasksHelper
  2 +end
3  todo/app/models/authentication.rb
... ... @@ -0,0 +1,3 @@
  1 +class Authentication < ActiveRecord::Base
  2 + belongs_to :user
  3 +end
4 todo/app/models/project.rb
... ... @@ -0,0 +1,4 @@
  1 +class Project < ActiveRecord::Base
  2 + attr_accessible :name
  3 + has_many :tasks
  4 +end
4 todo/app/models/task.rb
... ... @@ -0,0 +1,4 @@
  1 +class Task < ActiveRecord::Base
  2 + attr_accessible :project_id, :name, :completed_at
  3 + belongs_to :project
  4 +end
11 todo/app/models/user.rb
... ... @@ -0,0 +1,11 @@
  1 +class User < ActiveRecord::Base
  2 + has_many :authentications
  3 +
  4 + # Include default devise modules. Others available are:
  5 + # :token_authenticatable, :confirmable, :lockable and :timeoutable
  6 + devise :database_authenticatable, :registerable,
  7 + :recoverable, :rememberable, :trackable, :validatable
  8 +
  9 + # Setup accessible (or protected) attributes for your model
  10 + attr_accessible :email, :password, :password_confirmation, :remember_me
  11 +end
39 todo/app/views/authentications/index.html.erb
... ... @@ -0,0 +1,39 @@
  1 +<% title "Sign In" %>
  2 +
  3 +<% if @authentications %>
  4 + <% unless @authentications.empty? %>
  5 + <p><strong>You can sign in to this account using:</strong></p>
  6 + <div class="authentications">
  7 + <% for authentication in @authentications %>
  8 + <div class="authentication">
  9 + <%= image_tag "#{authentication.provider}_32.png", :size => "32x32" %>
  10 + <div class="provider"><%= authentication.provider.titleize %></div>
  11 + <div class="uid"><%= authentication.uid %></div>
  12 + <%= link_to "X", authentication, :confirm => 'Are you sure you want to remove this authentication option?', :method => :delete, :class => "remove" %>
  13 + </div>
  14 + <% end %>
  15 + <div class="clear"></div>
  16 + </div>
  17 + <% end %>
  18 + <p><strong>Add another service to sign in with:</strong></p>
  19 +<% else %>
  20 + <p><strong>Sign in through one of these services:</strong></p>
  21 +<% end %>
  22 +
  23 +<a href="/auth/twitter" class="auth_provider">
  24 + <%= image_tag "twitter_64.png", :size => "64x64", :alt => "Twitter" %>
  25 + Twitter
  26 +</a>
  27 +<a href="/auth/facebook" class="auth_provider">
  28 + <%= image_tag "facebook_64.png", :size => "64x64", :alt => "Facebook" %>
  29 + Facebook
  30 +</a>
  31 +<a href="/auth/google_apps" class="auth_provider">
  32 + <%= image_tag "google_64.png", :size => "64x64", :alt => "Google" %>
  33 + Google
  34 +</a>
  35 +<a href="/auth/open_id" class="auth_provider">
  36 + <%= image_tag "openid_64.png", :size => "64x64", :alt => "OpenID" %>
  37 + OpenID
  38 +</a>
  39 +<div class="clear"></div>
27 todo/app/views/layouts/application.html.erb
... ... @@ -0,0 +1,27 @@
  1 +<!DOCTYPE html>
  2 +<html>
  3 + <head>
  4 + <title><%= content_for?(:title) ? yield(:title) : "Untitled" %></title>
  5 + <%= stylesheet_link_tag "application" %>
  6 + <%= javascript_include_tag :defaults %>
  7 + <%= csrf_meta_tag %>
  8 + <%= yield(:head) %>
  9 + </head>
  10 + <body>
  11 + <div id="container">
  12 + <div id="user_nav">
  13 + <% if user_signed_in? %>
  14 + Signed in as <%= current_user.email %>. Not you?
  15 + <%= link_to "Sign out", destroy_user_session_path %>
  16 + <% else %>
  17 + <%= link_to "Sign up", new_user_registration_path %> or <%= link_to "sign in", new_user_session_path %>
  18 + <% end %>
  19 + </div>
  20 + <% flash.each do |name, msg| %>
  21 + <%= content_tag :div, msg, :id => "flash_#{name}" %>
  22 + <% end %>
  23 + <%= content_tag :h1, yield(:title) if show_title? %>
  24 + <%= yield %>
  25 + </div>
  26 + </body>
  27 +</html>
8 todo/app/views/projects/_form.html.erb
... ... @@ -0,0 +1,8 @@
  1 +<%= form_for @project do |f| %>
  2 + <%= f.error_messages %>
  3 + <p>
  4 + <%= f.label :name %><br />
  5 + <%= f.text_field :name %>
  6 + </p>
  7 + <p><%= f.submit %></p>
  8 +<% end %>
8 todo/app/views/projects/edit.html.erb
... ... @@ -0,0 +1,8 @@
  1 +<% title "Edit Project" %>
  2 +
  3 +<%= render 'form' %>
  4 +
  5 +<p>
  6 + <%= link_to "Show", @project %> |
  7 + <%= link_to "View All", projects_path %>
  8 +</p>
16 todo/app/views/projects/index.html.erb
... ... @@ -0,0 +1,16 @@
  1 +<% title "Projects" %>
  2 +
  3 +<table>
  4 + <tr>
  5 + <th>Name</th>
  6 + </tr>
  7 + <% for project in @projects %>
  8 + <tr>
  9 + <td><%= link_to project.name, project %></td>
  10 + <td><%= link_to "Edit", edit_project_path(project) %></td>
  11 + <td><%= link_to "Destroy", project, :confirm => 'Are you sure?', :method => :delete %></td>
  12 + </tr>
  13 + <% end %>
  14 +</table>
  15 +
  16 +<p><%= link_to "New Project", new_project_path %></p>
5 todo/app/views/projects/new.html.erb
... ... @@ -0,0 +1,5 @@
  1 +<% title "New Project" %>
  2 +
  3 +<%= render 'form' %>
  4 +
  5 +<p><%= link_to "Back to List", projects_path %></p>
17 todo/app/views/projects/show.html.erb
... ... @@ -0,0 +1,17 @@
  1 +<% title @project.name %>
  2 +
  3 +<h2>Tasks</h2>
  4 +<ul>
  5 + <% for task in @project.tasks %>
  6 + <li>
  7 + <%= task.name %>
  8 + (<%= link_to "Edit", edit_task_path(task) %> |
  9 + <%= link_to "Destroy", task, :confirm => "Are you sure?", :method => :delete %>)
  10 + </li>
  11 + <% end %>
  12 +</ul>
  13 +
  14 +<p>
  15 + <%= link_to "New Task", new_task_path(:project_id => @project) %> |
  16 + <%= link_to "View All Projects", projects_path %>
  17 +</p>
13 todo/app/views/tasks/_form.html.erb
... ... @@ -0,0 +1,13 @@
  1 +<%= form_for @task do |f| %>
  2 + <%= f.hidden_field :project_id %>
  3 + <%= f.error_messages %>
  4 + <p>
  5 + <%= f.label :name %><br />
  6 + <%= f.text_field :name %>
  7 + </p>
  8 + <p>
  9 + <%= f.label :completed_at %><br />
  10 + <%= f.date_select :completed_at %>
  11 + </p>
  12 + <p><%= f.submit %></p>
  13 +<% end %>
4 todo/app/views/tasks/edit.html.erb
... ... @@ -0,0 +1,4 @@
  1 +<% title "Edit Task" %>
  2 +
  3 +<%= render 'form' %>
  4 +
4 todo/app/views/tasks/new.html.erb
... ... @@ -0,0 +1,4 @@
  1 +<% title "New Task" %>
  2 +
  3 +<%= render 'form' %>
  4 +
4 todo/config.ru
... ... @@ -0,0 +1,4 @@
  1 +# This file is used by Rack-based servers to start the application.
  2 +
  3 +require ::File.expand_path('../config/environment', __FILE__)
  4 +run Todo::Application
42 todo/config/application.rb
... ... @@ -0,0 +1,42 @@
  1 +require File.expand_path('../boot', __FILE__)
  2 +
  3 +require 'rails/all'
  4 +
  5 +# If you have a Gemfile, require the gems listed there, including any gems
  6 +# you've limited to :test, :development, or :production.
  7 +Bundler.require(:default, Rails.env) if defined?(Bundler)
  8 +
  9 +module Todo
  10 + class Application < Rails::Application
  11 + # Settings in config/environments/* take precedence over those specified here.
  12 + # Application configuration should go into files in config/initializers
  13 + # -- all .rb files in that directory are automatically loaded.
  14 +
  15 + # Custom directories with classes and modules you want to be autoloadable.
  16 + # config.autoload_paths += %W(#{config.root}/extras)
  17 +
  18 + # Only load the plugins named here, in the order given (default is alphabetical).
  19 + # :all can be used as a placeholder for all plugins not explicitly named.
  20 + # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
  21 +
  22 + # Activate observers that should always be running.
  23 + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
  24 +
  25 + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
  26 + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
  27 + # config.time_zone = 'Central Time (US & Canada)'
  28 +
  29 + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
  30 + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
  31 + # config.i18n.default_locale = :de
  32 +
  33 + # JavaScript files you want as :defaults (application.js is always included).
  34 + # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
  35 +
  36 + # Configure the default encoding used in templates for Ruby 1.9.
  37 + config.encoding = "utf-8"
  38 +
  39 + # Configure sensitive parameters which will be filtered from the log file.
  40 + config.filter_parameters += [:password]
  41 + end
  42 +end
13 todo/config/boot.rb
... ... @@ -0,0 +1,13 @@
  1 +require 'rubygems'
  2 +
  3 +# Set up gems listed in the Gemfile.
  4 +gemfile = File.expand_path('../../Gemfile', __FILE__)
  5 +begin
  6 + ENV['BUNDLE_GEMFILE'] = gemfile
  7 + require 'bundler'
  8 + Bundler.setup
  9 +rescue Bundler::GemNotFound => e
  10 + STDERR.puts e.message
  11 + STDERR.puts "Try running `bundle install`."
  12 + exit!
  13 +end if File.exist?(gemfile)
22 todo/config/database.yml
... ... @@ -0,0 +1,22 @@
  1 +# SQLite version 3.x
  2 +# gem install sqlite3-ruby (not necessary on OS X Leopard)
  3 +development:
  4 + adapter: sqlite3
  5 + database: db/development.sqlite3
  6 + pool: 5
  7 + timeout: 5000
  8 +
  9 +# Warning: The database defined as "test" will be erased and
  10 +# re-generated from your development database when you run "rake".
  11 +# Do not set this db to the same as development or production.
  12 +test:
  13 + adapter: sqlite3
  14 + database: db/test.sqlite3
  15 + pool: 5
  16 + timeout: 5000
  17 +
  18 +production:
  19 + adapter: sqlite3
  20 + database: db/production.sqlite3
  21 + pool: 5
  22 + timeout: 5000
5 todo/config/environment.rb
... ... @@ -0,0 +1,5 @@
  1 +# Load the rails application
  2 +require File.expand_path('../application', __FILE__)
  3 +
  4 +# Initialize the rails application
  5 +Todo::Application.initialize!
27 todo/config/environments/development.rb
... ... @@ -0,0 +1,27 @@
  1 +Todo::Application.configure do
  2 + # Settings specified here will take precedence over those in config/environment.rb
  3 +
  4 + # In the development environment your application's code is reloaded on
  5 + # every request. This slows down response time but is perfect for development
  6 + # since you don't have to restart the webserver when you make code changes.
  7 + config.cache_classes = false
  8 +
  9 + # Log error messages when you accidentally call methods on nil.
  10 + config.whiny_nils = true
  11 +
  12 + # Show full error reports and disable caching
  13 + config.consider_all_requests_local = true
  14 + config.action_view.debug_rjs = true
  15 + config.action_controller.perform_caching = false
  16 +
  17 + # Don't care if the mailer can't send
  18 + config.action_mailer.raise_delivery_errors = false
  19 +
  20 + # Print deprecation notices to the Rails logger
  21 + config.active_support.deprecation = :log
  22 +
  23 + # Only use best-standards-support built into browsers
  24 + config.action_dispatch.best_standards_support = :builtin
  25 +
  26 + config.action_mailer.default_url_options = { :host => 'localhost:3000' }
  27 +end
49 todo/config/environments/production.rb
... ... @@ -0,0 +1,49 @@
  1 +Todo::Application.configure do
  2 + # Settings specified here will take precedence over those in config/environment.rb
  3 +
  4 + # The production environment is meant for finished, "live" apps.
  5 + # Code is not reloaded between requests
  6 + config.cache_classes = true
  7 +
  8 + # Full error reports are disabled and caching is turned on
  9 + config.consider_all_requests_local = false
  10 + config.action_controller.perform_caching = true
  11 +
  12 + # Specifies the header that your server uses for sending files
  13 + config.action_dispatch.x_sendfile_header = "X-Sendfile"
  14 +
  15 + # For nginx:
  16 + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
  17 +
  18 + # If you have no front-end server that supports something like X-Sendfile,
  19 + # just comment this out and Rails will serve the files
  20 +
  21 + # See everything in the log (default is :info)
  22 + # config.log_level = :debug
  23 +
  24 + # Use a different logger for distributed setups
  25 + # config.logger = SyslogLogger.new
  26 +
  27 + # Use a different cache store in production
  28 + # config.cache_store = :mem_cache_store
  29 +
  30 + # Disable Rails's static asset server
  31 + # In production, Apache or nginx will already do this
  32 + config.serve_static_assets = false
  33 +
  34 + # Enable serving of images, stylesheets, and javascripts from an asset server
  35 + # config.action_controller.asset_host = "http://assets.example.com"
  36 +
  37 + # Disable delivery errors, bad email addresses will be ignored
  38 + # config.action_mailer.raise_delivery_errors = false
  39 +
  40 + # Enable threaded mode
  41 + # config.threadsafe!
  42 +
  43 + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  44 + # the I18n.default_locale when a translation can not be found)
  45 + config.i18n.fallbacks = true
  46 +
  47 + # Send deprecation notices to registered listeners
  48 + config.active_support.deprecation = :notify
  49 +end
35 todo/config/environments/test.rb
... ... @@ -0,0 +1,35 @@
  1 +Todo::Application.configure do
  2 + # Settings specified here will take precedence over those in config/environment.rb
  3 +
  4 + # The test environment is used exclusively to run your application's
  5 + # test suite. You never need to work with it otherwise. Remember that
  6 + # your test database is "scratch space" for the test suite and is wiped
  7 + # and recreated between test runs. Don't rely on the data there!
  8 + config.cache_classes = true
  9 +
  10 + # Log error messages when you accidentally call methods on nil.
  11 + config.whiny_nils = true
  12 +
  13 + # Show full error reports and disable caching
  14 + config.consider_all_requests_local = true
  15 + config.action_controller.perform_caching = false
  16 +
  17 + # Raise exceptions instead of rendering exception templates
  18 + config.action_dispatch.show_exceptions = false
  19 +
  20 + # Disable request forgery protection in test environment
  21 + config.action_controller.allow_forgery_protection = false
  22 +
  23 + # Tell Action Mailer not to deliver emails to the real world.
  24 + # The :test delivery method accumulates sent emails in the
  25 + # ActionMailer::Base.deliveries array.
  26 + config.action_mailer.delivery_method = :test
  27 +
  28 + # Use SQL instead of Active Record's schema dumper when creating the test database.
  29 + # This is necessary if your schema can't be completely dumped by the schema dumper,
  30 + # like if you have constraints or database-specific column types
  31 + # config.active_record.schema_format = :sql
  32 +
  33 + # Print deprecation notices to the stderr
  34 + config.active_support.deprecation = :stderr
  35 +end
7 todo/config/initializers/backtrace_silencers.rb
... ... @@ -0,0 +1,7 @@
  1 +# Be sure to restart your server when you modify this file.
  2 +
  3 +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
  4 +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
  5 +
  6 +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
  7 +# Rails.backtrace_cleaner.remove_silencers!
142 todo/config/initializers/devise.rb
... ... @@ -0,0 +1,142 @@
  1 +# Use this hook to configure devise mailer, warden hooks and so forth. The first
  2 +# four configuration values can also be set straight in your models.
  3 +Devise.setup do |config|
  4 + # ==> Mailer Configuration
  5 + # Configure the e-mail address which will be shown in DeviseMailer.
  6 + config.mailer_sender = "please-change-me@config-initializers-devise.com"
  7 +
  8 + # Configure the class responsible to send e-mails.
  9 + # config.mailer = "Devise::Mailer"
  10 +
  11 + # ==> ORM configuration
  12 + # Load and configure the ORM. Supports :active_record (default) and
  13 + # :mongoid (bson_ext recommended) by default. Other ORMs may be
  14 + # available as additional gems.
  15 + require 'devise/orm/active_record'
  16 +
  17 + # ==> Configuration for any authentication mechanism
  18 + # Configure which keys are used when authenticating an user. By default is
  19 + # just :email. You can configure it to use [:username, :subdomain], so for
  20 + # authenticating an user, both parameters are required. Remember that those
  21 + # parameters are used only when authenticating and not when retrieving from
  22 + # session. If you need permissions, you should implement that in a before filter.
  23 + # config.authentication_keys = [ :email ]
  24 +
  25 + # Tell if authentication through request.params is enabled. True by default.
  26 + # config.params_authenticatable = true
  27 +
  28 + # Tell if authentication through HTTP Basic Auth is enabled. True by default.
  29 + # config.http_authenticatable = true
  30 +
  31 + # Set this to true to use Basic Auth for AJAX requests. True by default.
  32 + # config.http_authenticatable_on_xhr = true
  33 +
  34 + # The realm used in Http Basic Authentication
  35 + # config.http_authentication_realm = "Application"
  36 +
  37 + # ==> Configuration for :database_authenticatable
  38 + # For bcrypt, this is the cost for hashing the password and defaults to 10. If
  39 + # using other encryptors, it sets how many times you want the password re-encrypted.
  40 + config.stretches = 10
  41 +
  42 + # Define which will be the encryption algorithm. Devise also supports encryptors
  43 + # from others authentication tools as :clearance_sha1, :authlogic_sha512 (then
  44 + # you should set stretches above to 20 for default behavior) and :restful_authentication_sha1
  45 + # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
  46 + config.encryptor = :bcrypt
  47 +
  48 + # Setup a pepper to generate the encrypted password.
  49 + config.pepper = "c0cccd076213dc4069806d76ae105d61acc7cb8274f4a382f02e283b6f65d053e3886f7015a4932685a1c08b0cdb3429978e2d35ffa34db5be905a2fd0617a2a"
  50 +
  51 + # ==> Configuration for :confirmable
  52 + # The time you want to give your user to confirm his account. During this time
  53 + # he will be able to access your application without confirming. Default is nil.
  54 + # When confirm_within is zero, the user won't be able to sign in without confirming.
  55 + # You can use this to let your user access some features of your application
  56 + # without confirming the account, but blocking it after a certain period
  57 + # (ie 2 days).
  58 + # config.confirm_within = 2.days
  59 +
  60 + # ==> Configuration for :rememberable
  61 + # The time the user will be remembered without asking for credentials again.
  62 + # config.remember_for = 2.weeks
  63 +
  64 + # If true, a valid remember token can be re-used between multiple browsers.
  65 + # config.remember_across_browsers = true
  66 +
  67 + # If true, extends the user's remember period when remembered via cookie.
  68 + # config.extend_remember_period = false
  69 +
  70 + # ==> Configuration for :validatable
  71 + # Range for password length
  72 + # config.password_length = 6..20
  73 +
  74 + # Regex to use to validate the email address
  75 + # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
  76 +
  77 + # ==> Configuration for :timeoutable
  78 + # The time you want to timeout the user session without activity. After this
  79 + # time the user will be asked for credentials again.
  80 + # config.timeout_in = 10.minutes
  81 +
  82 + # ==> Configuration for :lockable
  83 + # Defines which strategy will be used to lock an account.
  84 + # :failed_attempts = Locks an account after a number of failed attempts to sign in.
  85 + # :none = No lock strategy. You should handle locking by yourself.
  86 + # config.lock_strategy = :failed_attempts
  87 +
  88 + # Defines which strategy will be used to unlock an account.
  89 + # :email = Sends an unlock link to the user email
  90 + # :time = Re-enables login after a certain amount of time (see :unlock_in below)
  91 + # :both = Enables both strategies
  92 + # :none = No unlock strategy. You should handle unlocking by yourself.
  93 + # config.unlock_strategy = :both
  94 +
  95 + # Number of authentication tries before locking an account if lock_strategy
  96 + # is failed attempts.
  97 + # config.maximum_attempts = 20
  98 +
  99 + # Time interval to unlock the account if :time is enabled as unlock_strategy.
  100 + # config.unlock_in = 1.hour
  101 +
  102 + # ==> Configuration for :token_authenticatable
  103 + # Defines name of the authentication token params key
  104 + # config.token_authentication_key = :auth_token