List of Listings

Chapter 1. Ruby on Rails, the framework

Listing 1.1. db/migrate/[date]_create_purchases.rb

Listing 1.2. app/views/purchases/new.html.erb

Listing 1.3. First half of app/views/purchases/_form.html.erb

Listing 1.4. app/controllers/purchases_controller.rb

Listing 1.5. Second half of app/views/purchases/_form.html.erb

Listing 1.6. app/controllers/purchases_controller.rb

Listing 1.7. app/models/purchase.rb

Listing 1.8. app/views/purchases/show.html.erb

Listing 1.9. app/controllers/purchases_controller.rb

Listing 1.10. config/routes.rb

Listing 1.11. The HTML source of app/views/purchases/new.html.erb

Listing 1.12. app/views/purchases/edit.html.erb

Listing 1.13. app/controllers/purchases_controller.rb

Listing 1.14. The HTML source of app/views/purchases/edit.html.erb

Listing 1.15. app/controllers/purchases_controller.rb

Listing 1.16. app/views/purchases/index.html.erb

Listing 1.17. app/controllers/purchases_controller.rb

Chapter 2. Testing saves your bacon

Listing 2.1. example/example_test.rb

Listing 2.2. example/example_test.rb, alternate truth test

Listing 2.3. example/bacon_test.rb

Listing 2.4. example/bacon_test.rb

Listing 2.5. example/bacon_test.rb

Listing 2.6. bacon/spec/bacon_spec.rb

Listing 2.7. bacon/lib/bacon.rb

Listing 2.8. bacon/lib/bacon.rb

Listing 2.9. bacon/lib/bacon.rb

Listing 2.10. bacon/lib/bacon.rb

Listing 2.11. bacon/spec/bacon_spec.rb

Listing 2.12. Terminal

Listing 2.13. bacon/spec/bacon_spec.rb

Listing 2.14. bacon/spec/bacon_spec.rb

Listing 2.15. bacon/spec/bacon_spec.rb

Listing 2.16. bacon/lib/bacon.rb

Listing 2.17. bacon/lib/bacon.rb

Listing 2.18. bacon/lib/bacon.rb

Listing 2.19. Example

Listing 2.20. Example

Listing 2.21. accounts/features/account.feature

Listing 2.22. accounts/features/account.feature

Listing 2.23. accounts/features/account.feature

Listing 2.24. Terminal

Listing 2.25. features/step_definitions/account_steps.rb

Listing 2.26. features/step_definitions/account_steps.rb

Listing 2.27. accounts/lib/account.rb

Listing 2.28. features/step_definitions/account_steps.rb

Listing 2.29. accounts/lib/account.rb

Listing 2.30. accounts/lib/account.rb

Listing 2.31. accounts/lib/account.rb

Listing 2.32. features/step_definitions/account_steps.rb

Listing 2.33. features/step_definitions/account_steps.rb

Chapter 3. Developing a real Rails application

Listing 3.1. Configuring your identity in GitHub

Listing 3.2. Viewing the commit log

Listing 3.3. Terminal

Listing 3.4. Gemfile

Listing 3.5. Check for RSpec and Cucumber gems

Listing 3.6. config/database.yml

Listing 3.7. config/database.yml

Listing 3.8. features/creating_projects.feature

Listing 3.9. config/routes.rb

Listing 3.10. app/controllers/projects_controller.rb

Listing 3.11. config/routes.rb

Listing 3.12. rake routes output

Listing 3.13. app/controllers/projects_controller.rb

Listing 3.14. db/migrate/[date]_create_projects.rb

Listing 3.15. app/views/projects/_form.html.erb

Listing 3.16. app/views/projects/_form.html.erb

Listing 3.17. app/controllers/projects_controller.rb

Listing 3.18. app/controllers/projects_controller.rb

Listing 3.19. features/creating_projects.feature

Listing 3.20. features/support/paths.rb

Listing 3.21. features/support/paths.rb

Listing 3.22. app/views/projects/show.html.erb

Listing 3.23. app/views/layouts/application.html.erb

Listing 3.24. app/helpers/application_helper.rb

Listing 3.25. features/creating_projects.feature

Listing 3.26. features/creating_projects.feature

Listing 3.27. features/creating_projects.feature

Listing 3.28. app/models/project.rb

Listing 3.29. app/controllers/projects_controller.rb

Listing 3.30. app/controllers/projects_controller.rb

Chapter 4. Oh CRUD!

Listing 4.1. features/viewing_projects.feature

Listing 4.2. features/viewing_projects.feature failure

Listing 4.3. app/views/projects/index.html.erb

Listing 4.4. app/controllers/projects_controller.rb

Listing 4.5. features/editing_projects.feature

Listing 4.6. app/views/projects/show.html.erb

Listing 4.7. app/controllers/projects_controller.rb

Listing 4.8. app/views/projects/edit.html.erb

Listing 4.9. app/controllers/projects_controller.rb

Listing 4.10. features/editing_projects.feature

Listing 4.11. features/editing_projects.feature

Listing 4.12. app/controllers/projects_controller.rb

Listing 4.13. features/deleting_projects.feature

Listing 4.14. app/views/projects/show.html.erb

Listing 4.15. app/controllers/projects_controller.rb

Listing 4.16. spec/controllers/projects_controller_spec.rb

Listing 4.17. app/controllers/projects_controller.rb

Chapter 5. Nested resources

Listing 5.1. features/creating_tickets.feature

Listing 5.2. app/views/projects/show.html.erb

Listing 5.3. config/routes.rb

Listing 5.4. app/controllers/tickets_controller.rb

Listing 5.5. app/views/tickets/_form.html.erb

Listing 5.6. app/models/ticket.rb

Listing 5.7. app/models/ticket.rb

Listing 5.8. features/viewing_tickets.feature

Listing 5.9. features/step_definitions/ticket_steps.rb

Listing 5.10. app/views/projects/show.html.erb

Listing 5.11. app/views/layouts/application.html.erb

Listing 5.12. features/editing_tickets.feature

Listing 5.13. app/controllers/tickets_controller.rb

Listing 5.14. app/controllers/tickets_controller.rb

Listing 5.15. features/deleting_tickets.feature

Listing 5.16. app/views/tickets/show.html.erb

Chapter 6. Authentication and basic authorization

Listing 6.1. app/models/user.rb

Listing 6.2. features/signing_up.feature

Listing 6.3. features/signing_in.feature

Listing 6.4. features/step_definitions/user_steps.rb

Listing 6.5. db/migrate/[timestamp]_add_confirmable_fields_to_users.rb

Listing 6.6. features/signing_in.feature

Listing 6.7. app/views/layouts/application.html.erb

Listing 6.8. features/creating_tickets.feature

Listing 6.9. db/migrate/[timestamp]_add_user_id_to_tickets.rb

Listing 6.10. features/viewing_tickets.feature

Listing 6.11. features/editing_tickets.feature

Listing 6.12. features/user_steps.rb

Listing 6.13. features/signing_in.feature

Listing 6.14. features/deleting_tickets.feature

Chapter 7. Basic access control

Listing 7.1. features/creating_projects.feature

Listing 7.2. features/creating_projects.feature

Listing 7.3. spec/controllers/projects_controller_spec.rb

Listing 7.4. spec/controllers/projects_controller_spec.rb

Listing 7.5. spec/spec_helper.rb

Listing 7.6. spec/support/devise.rb

Listing 7.7. app/controllers/application_controller.rb

Listing 7.8. app/controllers/projects_controller.rb

Listing 7.9. spec/controllers/projects_controller_spec.rb

Listing 7.10. features/deleting_projects.feature

Listing 7.11. features/hidden_links.feature

Listing 7.12. features/step_definitions/link_steps.rb

Listing 7.13. features/step_definitions/user_steps.rb

Listing 7.14. features/hidden_links.feature

Listing 7.15. app/views/projects/show.html.erb

Listing 7.16. spec/controllers/admin/users_controller_spec.rb

Listing 7.17. spec/support/seed_helpers.rb

Listing 7.18. config/routes.rb

Listing 7.19. features/creating_users.feature

Listing 7.20. app/controllers/admin/base_controller.rb

Listing 7.21. app/controllers/admin/users_controller.rb

Listing 7.22. app/views/admin/users/index.html.erb

Listing 7.23. app/views/admin/users/_form.html.erb

Listing 7.24. features/creating_users.feature

Listing 7.25. app/controllers/admin/users_controller.rb

Listing 7.26. features/editing_users.feature

Listing 7.27. app/controllers/admin/users_controller.rb

Listing 7.28. app/controllers/admin/users_controller.rb

Listing 7.29. app/controllers/admin/users_controller.rb

Listing 7.30. app/controllers/admin/users_controller.rb

Listing 7.31. features/deleting_users.feature

Listing 7.32. app/controllers/admin/users_controller.rb

Listing 7.33. features/deleting_users.feature

Listing 7.34. app/controllers/admin/users_controller.rb

Chapter 8. More authorization

Listing 8.1. features/viewing_projects.feature

Listing 8.2. features/step_definitions/permission_steps.rb

Listing 8.3. spec/controllers/projects_controller_spec.rb

Listing 8.4. app/controllers/projects_controller.rb

Listing 8.5. spec/controllers/tickets_controller_spec.rb

Listing 8.6. features/step_definitions/permission_steps.rb

Listing 8.7. spec/controllers/tickets_controller_spec.rb

Listing 8.8. app/models/ability.rb

Listing 8.9. Update tests for spec/controllers/tickets_controller_spec.rb

Listing 8.10. app/controllers/tickets_controller.rb

Listing 8.11. features/hidden_links.feature

Listing 8.12. features/hidden_links.feature

Listing 8.13. features/deleting_tickets.feature

Listing 8.14. features/assigning_permissions.feature

Listing 8.15. app/controllers/admin/permissions_controller.rb

Listing 8.16. app/views/admin/permissions/index.html.erb

Listing 8.17. app/helpers/admin/permissions_helper.rb

Listing 8.18. update action inside app/controllers/admin/permissions_controller.rb

Listing 8.19. features/assigning_permissions.feature

Listing 8.20. features/assigning_permissions.feature

Listing 8.21. features/seed.feature

Listing 8.22. db/seeds.rb

Listing 8.23. db/seeds.rb

Chapter 9. File uploading

Listing 9.1. features/creating_tickets.feature

Listing 9.2. app/views/tickets/_form.html.erb

Listing 9.3. attr_accessor example

Listing 9.4. db/migrate/[time]_add_attachment_asset_to_ticket.rb

Listing 9.5. app/views/tickets/show.html.erb

Listing 9.6. File attachment scenario, features/creating_tickets.feature

Listing 9.7. db/migrate/[date]_create_assets.rb

Listing 9.8. spec/controllers/files_controller_spec.rb

Listing 9.9. spec/controllers/assets_controller_spec.rb

Listing 9.10. spec/controllers/assets_controller_spec.rb

Listing 9.11. app/controllers/files_controller.rb

Listing 9.12. app/controllers/files_controller.rb

Listing 9.13. features/creating_tickets.feature

Listing 9.14. app/views/tickets/_form.html.erb

Listing 9.15. app/views/files/_form.html.erb

Chapter 10. Tracking state

Listing 10.1. features/creating_comments.feature

Listing 10.2. app/views/projects/index.html.erb

Listing 10.3. app/views/comments/_form.html.erb

Listing 10.4. app/controllers/tickets_controller.rb

Listing 10.5. config/routes.rb

Listing 10.6. app/controllers/comments_controller.rb

Listing 10.7. app/views/tickets/show.html.erb

Listing 10.8. app/views/comments/_comment.html.erb

Listing 10.9. features/creating_comments.feature

Listing 10.10. db/migrate/[date]_create_states.rb

Listing 10.11. app/views/comments/_form.html.erb

Listing 10.12. app/models/comment.rb

Listing 10.13. app/models/comment.rb

Listing 10.14. features/seed.feature, the basics scenario

Listing 10.15. db/seeds.rb

Listing 10.16. features/creating_comments.feature:26

Listing 10.17. app/controllers/comments_controller.rb

Listing 10.18. app/controllers/comments_controller.rb

Listing 10.19. db/migrate_[date]_add_previous_state_id_to_comments.rb

Listing 10.20. app/helpers/tickets_helper.rb

Listing 10.21. features/creating_states.feature

Listing 10.22. app/controllers/admin/states_controller.rb

Listing 10.23. app/views/admin/states/index.html.erb

Listing 10.24. app/controllers/admin/states_controller.rb

Listing 10.25. features/managing_states.feature

Listing 10.26. app/controllers/admin/states_controller.rb

Listing 10.27. app/models/state.rb

Listing 10.28. app/views/comments/_form.html.erb

Listing 10.29. features/assigning_permissions.feature

Listing 10.30. spec/controllers/comments_controller_spec.rb

Listing 10.31. spec/controllers/comments_controller_spec.rb

Chapter 11. Tagging

Listing 11.1. features/creating_tickets.feature

Listing 11.2. features/creating_comments.feature

Listing 11.3. features/deleting_tags.feature

Listing 11.4. features/searching.feature

Chapter 12. Sending email

Listing 12.1. features/ticket_notifications.feature

Listing 12.2. db/migrate/[timestamp]_create_ticket_watchers_table.rb

Listing 12.3. app/views/notifier/comment_updated.text.erb

Listing 12.4. app/views/notifier/comment_updated.html.erb

Listing 12.5. features/ticket_notifications.feature

Listing 12.6. features/watching_tickets.feature

Listing 12.7. features/watching_tickets.feature

Listing 12.8. app/views/tickets/show.html.erb

Listing 12.9. app/helpers/tickets_helper.rb

Listing 12.10. config/routes.rb

Listing 12.11. app/controllers/tickets_controller.rb

Listing 12.12. features/gmail.feature

Listing 12.13. config/initializers/mail.rb

Listing 12.14. app/mailers/notifier_spec.rb

Listing 12.15. spec/mailers/receiver_spec.rb

Chapter 13. Designing an API

Listing 13.1. config/routes.rb

Listing 13.2. spec/support/api/helper.rb

Listing 13.3. spec/api/v1/projects_spec.rb

Listing 13.4. spec/api/v1/projects_spec.rb

Listing 13.5. spec/api/v1/authentication_spec.rb

Listing 13.6. app/controllers/api/v1/base_controller.rb

Listing 13.7. spec/api/v1/projects_spec.rb

Listing 13.8. spec/api/v1/projects_spec.rb

Listing 13.9. app/controllers/projects_controller.rb

Listing 13.10. spec/api/v1/projects_spec.rb

Listing 13.11. spec/api/v1/project_errors_spec.rb

Listing 13.12. app/controllers/api/v1/base_controller.rb

Listing 13.13. spec/api/v1/projects_spec.rb

Listing 13.14. app/controllers/api/v1/projects_controller.rb

Listing 13.15. spec/api/v1/project_errors_spec.rb

Listing 13.16. app/controllers/api/v1/projects_controller.rb

Listing 13.17. spec/api/v1/projects_spec.rb

Listing 13.18. app/controllers/api/v1/projects_controller.rb

Listing 13.19. spec/api/v1/projects_spec.rb

Listing 13.20. spec/v1/api/projects_spec.rb

Listing 13.21. spec/api/v1/tickets_spec.rb

Listing 13.22. spec/api/v1/projects_spec.rb

Listing 13.23. app/controllers/api/v1/tickets_controller.rb

Listing 13.24. app/controllers/api/v1/tickets_controller.rb

Listing 13.25. spec/v1/api/rate_limit_spec.rb

Listing 13.26. spec/v1/api/rate_limit_spec.rb

Listing 13.27. api/controllers/v1/base_controller.rb

Listing 13.28. spec/models/user_spec.rb

Listing 13.29. spec/api/v2/projects_spec.rb

Listing 13.30. spec/api/v2/projects_spec.rb

Chapter 14. Deployment

Listing 14.1. /opt/nginx/conf/nginx.conf

Chapter 15. Alternative authentication

Listing 15.1. features/twitter_auth.feature

Listing 15.2. features/step_definitions/oauth_steps.rb

Listing 15.3. app/controllers/users/omniauth_callbacks_controller.rb

Listing 15.4. app/models/user.rb

Listing 15.5. db/migrate/[timestamp]_add_twitter_fields_to_users.rb

Listing 15.6. app/models/user.rb

Listing 15.7. features/github_auth.feature

Listing 15.8. app/helpers/oauth_helper.rb

Listing 15.9. app/controllers/users/omniauth_callbacks_controller.rb

Listing 15.10. app/models/user/omniauth_callbacks.rb

Listing 15.11. app/models/user/omniauth_callbacks.rb

Listing 15.12. db/migrate/[timestamp]_add_github_fields_to_users.rb

Chapter 16. Basic performance enhancements

Listing 16.1. features/paginating_tickets.feature

Listing 16.2. features/step_definitions/ticket_steps.rb

Listing 16.3. spec/api/v2/tickets_spec.rb

Listing 16.4. app/sweepers/tickets_sweeper.rb

Listing 16.5. app/views/projects/show.html.erb

Listing 16.6. app/jobs/comment_notifier_job.rb

Listing 16.7. spec/models/comment_spec.rb

Chapter 17. Engines

Listing 17.1. spec/integration/topics_spec.rb

Listing 17.2. spec/support/load_routes.rb

Listing 17.3. app/controllers/forem/topics_controller.rb

Listing 17.4. spec/dummy/config/database.yml

Listing 17.5. app/views/forem/topics/index.html.erb

Listing 17.6. app/views/forem/topics/_form.html.erb

Listing 17.7. app/controllers/forem/topics_controller.rb

Listing 17.8. app/views/forem/topics/show.html.erb

Listing 17.9. spec/integration/posts_spec.rb

Listing 17.10. spec/integration/posts_spec.rb

Listing 17.11. app/controllers/forem/posts_controller.rb

Listing 17.12. spec/configuration_spec.rb

Listing 17.13. spec/support/dummy_login.rb

Listing 17.14. spec/integration/topics_spec.rb

Listing 17.15. spec/integration/topics_spec.rb

Listing 17.16. app/models/forem/topic.rb

Listing 17.17. spec/integration/posts_spec.rb

Listing 17.18. spec/integration/posts_spec.rb

Listing 17.19. spec/integration/posts_spec.rb

Chapter 18. Rack-based applications

Listing 18.1. lib/heartbeat.ru

Listing 18.2. lib/heartbeat/application.rb

Listing 18.3. lib/heartbeat/config.ru

Listing 18.4. lib/heartbeat/test_application.rb

Listing 18.5. lib/heartbeat/config.ru

Listing 18.6. sin.rb

Listing 18.7. spec/api/v3/json/tickets_spec.rb

Listing 18.8. app/controllers/api/v3/json/tickets.rb

Listing 18.9. spec/api/v3/json/tickets_spec.rb

Listing 18.10. lib/action_dispatch/middleware/static.rb

Listing 18.11. lib/link_jumbler.rb

Appendix B. Tidbits

Listing B.1. spec/models/ticket_spec.rb

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.83.176