reflexive 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. data/Rakefile +3 -1
  2. data/reflexive.gemspec +3 -1
  3. data/views/dashboard.erb +6 -6
  4. metadata +2 -125
  5. data/spec/test_apps/rails2_test_app/README +0 -243
  6. data/spec/test_apps/rails2_test_app/Rakefile +0 -10
  7. data/spec/test_apps/rails2_test_app/app/controllers/application_controller.rb +0 -10
  8. data/spec/test_apps/rails2_test_app/app/controllers/posts_controller.rb +0 -85
  9. data/spec/test_apps/rails2_test_app/app/helpers/application_helper.rb +0 -3
  10. data/spec/test_apps/rails2_test_app/app/helpers/posts_helper.rb +0 -2
  11. data/spec/test_apps/rails2_test_app/app/models/post.rb +0 -5
  12. data/spec/test_apps/rails2_test_app/app/views/layouts/posts.html.erb +0 -17
  13. data/spec/test_apps/rails2_test_app/app/views/posts/edit.html.erb +0 -12
  14. data/spec/test_apps/rails2_test_app/app/views/posts/index.html.erb +0 -18
  15. data/spec/test_apps/rails2_test_app/app/views/posts/new.html.erb +0 -11
  16. data/spec/test_apps/rails2_test_app/app/views/posts/show.html.erb +0 -3
  17. data/spec/test_apps/rails2_test_app/config/boot.rb +0 -110
  18. data/spec/test_apps/rails2_test_app/config/database.yml +0 -22
  19. data/spec/test_apps/rails2_test_app/config/environment.rb +0 -43
  20. data/spec/test_apps/rails2_test_app/config/environments/development.rb +0 -17
  21. data/spec/test_apps/rails2_test_app/config/environments/production.rb +0 -28
  22. data/spec/test_apps/rails2_test_app/config/environments/test.rb +0 -28
  23. data/spec/test_apps/rails2_test_app/config/initializers/backtrace_silencers.rb +0 -7
  24. data/spec/test_apps/rails2_test_app/config/initializers/inflections.rb +0 -10
  25. data/spec/test_apps/rails2_test_app/config/initializers/mime_types.rb +0 -5
  26. data/spec/test_apps/rails2_test_app/config/initializers/new_rails_defaults.rb +0 -21
  27. data/spec/test_apps/rails2_test_app/config/initializers/session_store.rb +0 -15
  28. data/spec/test_apps/rails2_test_app/config/locales/en.yml +0 -5
  29. data/spec/test_apps/rails2_test_app/config/routes.rb +0 -45
  30. data/spec/test_apps/rails2_test_app/db/development.sqlite3 +0 -0
  31. data/spec/test_apps/rails2_test_app/db/migrate/20100512073155_create_posts.rb +0 -12
  32. data/spec/test_apps/rails2_test_app/db/schema.rb +0 -19
  33. data/spec/test_apps/rails2_test_app/db/seeds.rb +0 -7
  34. data/spec/test_apps/rails2_test_app/doc/README_FOR_APP +0 -2
  35. data/spec/test_apps/rails2_test_app/log/development.log +0 -251
  36. data/spec/test_apps/rails2_test_app/log/production.log +0 -0
  37. data/spec/test_apps/rails2_test_app/log/server.log +0 -0
  38. data/spec/test_apps/rails2_test_app/log/test.log +0 -0
  39. data/spec/test_apps/rails2_test_app/public/404.html +0 -30
  40. data/spec/test_apps/rails2_test_app/public/422.html +0 -30
  41. data/spec/test_apps/rails2_test_app/public/500.html +0 -30
  42. data/spec/test_apps/rails2_test_app/public/favicon.ico +0 -0
  43. data/spec/test_apps/rails2_test_app/public/images/rails.png +0 -0
  44. data/spec/test_apps/rails2_test_app/public/index.html +0 -275
  45. data/spec/test_apps/rails2_test_app/public/javascripts/application.js +0 -2
  46. data/spec/test_apps/rails2_test_app/public/javascripts/controls.js +0 -963
  47. data/spec/test_apps/rails2_test_app/public/javascripts/dragdrop.js +0 -973
  48. data/spec/test_apps/rails2_test_app/public/javascripts/effects.js +0 -1128
  49. data/spec/test_apps/rails2_test_app/public/javascripts/prototype.js +0 -4320
  50. data/spec/test_apps/rails2_test_app/public/robots.txt +0 -5
  51. data/spec/test_apps/rails2_test_app/public/stylesheets/1.css +0 -0
  52. data/spec/test_apps/rails2_test_app/public/stylesheets/scaffold.css +0 -54
  53. data/spec/test_apps/rails2_test_app/script/about +0 -4
  54. data/spec/test_apps/rails2_test_app/script/console +0 -3
  55. data/spec/test_apps/rails2_test_app/script/dbconsole +0 -3
  56. data/spec/test_apps/rails2_test_app/script/destroy +0 -3
  57. data/spec/test_apps/rails2_test_app/script/generate +0 -3
  58. data/spec/test_apps/rails2_test_app/script/performance/benchmarker +0 -3
  59. data/spec/test_apps/rails2_test_app/script/performance/profiler +0 -3
  60. data/spec/test_apps/rails2_test_app/script/plugin +0 -3
  61. data/spec/test_apps/rails2_test_app/script/runner +0 -3
  62. data/spec/test_apps/rails2_test_app/script/server +0 -3
  63. data/spec/test_apps/rails2_test_app/test/fixtures/posts.yml +0 -7
  64. data/spec/test_apps/rails2_test_app/test/functional/posts_controller_test.rb +0 -45
  65. data/spec/test_apps/rails2_test_app/test/performance/browsing_test.rb +0 -9
  66. data/spec/test_apps/rails2_test_app/test/test_helper.rb +0 -38
  67. data/spec/test_apps/rails2_test_app/test/unit/helpers/posts_helper_test.rb +0 -4
  68. data/spec/test_apps/rails2_test_app/test/unit/post_test.rb +0 -8
  69. data/spec/test_apps/rails3_test_app/Gemfile +0 -28
  70. data/spec/test_apps/rails3_test_app/README +0 -244
  71. data/spec/test_apps/rails3_test_app/Rakefile +0 -10
  72. data/spec/test_apps/rails3_test_app/app/controllers/application_controller.rb +0 -4
  73. data/spec/test_apps/rails3_test_app/app/controllers/posts_controller.rb +0 -83
  74. data/spec/test_apps/rails3_test_app/app/helpers/application_helper.rb +0 -2
  75. data/spec/test_apps/rails3_test_app/app/helpers/posts_helper.rb +0 -2
  76. data/spec/test_apps/rails3_test_app/app/models/post.rb +0 -2
  77. data/spec/test_apps/rails3_test_app/app/views/layouts/application.html.erb +0 -14
  78. data/spec/test_apps/rails3_test_app/app/views/posts/_form.html.erb +0 -16
  79. data/spec/test_apps/rails3_test_app/app/views/posts/edit.html.erb +0 -6
  80. data/spec/test_apps/rails3_test_app/app/views/posts/index.html.erb +0 -21
  81. data/spec/test_apps/rails3_test_app/app/views/posts/new.html.erb +0 -5
  82. data/spec/test_apps/rails3_test_app/app/views/posts/show.html.erb +0 -5
  83. data/spec/test_apps/rails3_test_app/config/application.rb +0 -49
  84. data/spec/test_apps/rails3_test_app/config/boot.rb +0 -6
  85. data/spec/test_apps/rails3_test_app/config/database.yml +0 -22
  86. data/spec/test_apps/rails3_test_app/config/environment.rb +0 -5
  87. data/spec/test_apps/rails3_test_app/config/environments/development.rb +0 -19
  88. data/spec/test_apps/rails3_test_app/config/environments/production.rb +0 -42
  89. data/spec/test_apps/rails3_test_app/config/environments/test.rb +0 -32
  90. data/spec/test_apps/rails3_test_app/config/initializers/backtrace_silencers.rb +0 -7
  91. data/spec/test_apps/rails3_test_app/config/initializers/inflections.rb +0 -10
  92. data/spec/test_apps/rails3_test_app/config/initializers/mime_types.rb +0 -5
  93. data/spec/test_apps/rails3_test_app/config/initializers/secret_token.rb +0 -7
  94. data/spec/test_apps/rails3_test_app/config/initializers/session_store.rb +0 -8
  95. data/spec/test_apps/rails3_test_app/config/locales/en.yml +0 -5
  96. data/spec/test_apps/rails3_test_app/config/routes.rb +0 -60
  97. data/spec/test_apps/rails3_test_app/config.ru +0 -4
  98. data/spec/test_apps/rails3_test_app/db/development.sqlite3 +0 -0
  99. data/spec/test_apps/rails3_test_app/db/migrate/20100512075428_create_posts.rb +0 -12
  100. data/spec/test_apps/rails3_test_app/db/schema.rb +0 -19
  101. data/spec/test_apps/rails3_test_app/db/seeds.rb +0 -7
  102. data/spec/test_apps/rails3_test_app/doc/README_FOR_APP +0 -2
  103. data/spec/test_apps/rails3_test_app/log/development.log +0 -349
  104. data/spec/test_apps/rails3_test_app/log/production.log +0 -0
  105. data/spec/test_apps/rails3_test_app/log/server.log +0 -0
  106. data/spec/test_apps/rails3_test_app/log/test.log +0 -0
  107. data/spec/test_apps/rails3_test_app/public/404.html +0 -26
  108. data/spec/test_apps/rails3_test_app/public/422.html +0 -26
  109. data/spec/test_apps/rails3_test_app/public/500.html +0 -26
  110. data/spec/test_apps/rails3_test_app/public/favicon.ico +0 -0
  111. data/spec/test_apps/rails3_test_app/public/images/rails.png +0 -0
  112. data/spec/test_apps/rails3_test_app/public/index.html +0 -279
  113. data/spec/test_apps/rails3_test_app/public/javascripts/application.js +0 -2
  114. data/spec/test_apps/rails3_test_app/public/javascripts/controls.js +0 -965
  115. data/spec/test_apps/rails3_test_app/public/javascripts/dragdrop.js +0 -974
  116. data/spec/test_apps/rails3_test_app/public/javascripts/effects.js +0 -1123
  117. data/spec/test_apps/rails3_test_app/public/javascripts/prototype.js +0 -4874
  118. data/spec/test_apps/rails3_test_app/public/javascripts/rails.js +0 -118
  119. data/spec/test_apps/rails3_test_app/public/robots.txt +0 -5
  120. data/spec/test_apps/rails3_test_app/public/stylesheets/scaffold.css +0 -60
  121. data/spec/test_apps/rails3_test_app/script/rails +0 -9
  122. data/spec/test_apps/rails3_test_app/test/fixtures/posts.yml +0 -11
  123. data/spec/test_apps/rails3_test_app/test/functional/posts_controller_test.rb +0 -49
  124. data/spec/test_apps/rails3_test_app/test/performance/browsing_test.rb +0 -9
  125. data/spec/test_apps/rails3_test_app/test/test_helper.rb +0 -13
  126. data/spec/test_apps/rails3_test_app/test/unit/helpers/posts_helper_test.rb +0 -4
  127. data/spec/test_apps/rails3_test_app/test/unit/post_test.rb +0 -8
@@ -1,5 +0,0 @@
1
- # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
- #
3
- # To ban all spiders from the entire site uncomment the next two lines:
4
- # User-Agent: *
5
- # Disallow: /
@@ -1,54 +0,0 @@
1
- body { background-color: #fff; color: #333; }
2
-
3
- body, p, ol, ul, td {
4
- font-family: verdana, arial, helvetica, sans-serif;
5
- font-size: 13px;
6
- line-height: 18px;
7
- }
8
-
9
- pre {
10
- background-color: #eee;
11
- padding: 10px;
12
- font-size: 11px;
13
- }
14
-
15
- a { color: #000; }
16
- a:visited { color: #666; }
17
- a:hover { color: #fff; background-color:#000; }
18
-
19
- .fieldWithErrors {
20
- padding: 2px;
21
- background-color: red;
22
- display: table;
23
- }
24
-
25
- #errorExplanation {
26
- width: 400px;
27
- border: 2px solid red;
28
- padding: 7px;
29
- padding-bottom: 12px;
30
- margin-bottom: 20px;
31
- background-color: #f0f0f0;
32
- }
33
-
34
- #errorExplanation h2 {
35
- text-align: left;
36
- font-weight: bold;
37
- padding: 5px 5px 5px 15px;
38
- font-size: 12px;
39
- margin: -7px;
40
- background-color: #c00;
41
- color: #fff;
42
- }
43
-
44
- #errorExplanation p {
45
- color: #333;
46
- margin-bottom: 0;
47
- padding: 5px;
48
- }
49
-
50
- #errorExplanation ul li {
51
- font-size: 12px;
52
- list-style: square;
53
- }
54
-
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.expand_path('../../config/boot', __FILE__)
3
- $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
4
- require 'commands/about'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.expand_path('../../config/boot', __FILE__)
3
- require 'commands/console'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.expand_path('../../config/boot', __FILE__)
3
- require 'commands/dbconsole'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.expand_path('../../config/boot', __FILE__)
3
- require 'commands/destroy'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.expand_path('../../config/boot', __FILE__)
3
- require 'commands/generate'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.expand_path('../../../config/boot', __FILE__)
3
- require 'commands/performance/benchmarker'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.expand_path('../../../config/boot', __FILE__)
3
- require 'commands/performance/profiler'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.expand_path('../../config/boot', __FILE__)
3
- require 'commands/plugin'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.expand_path('../../config/boot', __FILE__)
3
- require 'commands/runner'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.expand_path('../../config/boot', __FILE__)
3
- require 'commands/server'
@@ -1,7 +0,0 @@
1
- # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
-
3
- # one:
4
- # column: value
5
- #
6
- # two:
7
- # column: value
@@ -1,45 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PostsControllerTest < ActionController::TestCase
4
- test "should get index" do
5
- get :index
6
- assert_response :success
7
- assert_not_nil assigns(:posts)
8
- end
9
-
10
- test "should get new" do
11
- get :new
12
- assert_response :success
13
- end
14
-
15
- test "should create post" do
16
- assert_difference('Post.count') do
17
- post :create, :post => { }
18
- end
19
-
20
- assert_redirected_to post_path(assigns(:post))
21
- end
22
-
23
- test "should show post" do
24
- get :show, :id => posts(:one).to_param
25
- assert_response :success
26
- end
27
-
28
- test "should get edit" do
29
- get :edit, :id => posts(:one).to_param
30
- assert_response :success
31
- end
32
-
33
- test "should update post" do
34
- put :update, :id => posts(:one).to_param, :post => { }
35
- assert_redirected_to post_path(assigns(:post))
36
- end
37
-
38
- test "should destroy post" do
39
- assert_difference('Post.count', -1) do
40
- delete :destroy, :id => posts(:one).to_param
41
- end
42
-
43
- assert_redirected_to posts_path
44
- end
45
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
- require 'performance_test_help'
3
-
4
- # Profiling results for each test method are written to tmp/performance.
5
- class BrowsingTest < ActionController::PerformanceTest
6
- def test_homepage
7
- get '/'
8
- end
9
- end
@@ -1,38 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
- require 'test_help'
4
-
5
- class ActiveSupport::TestCase
6
- # Transactional fixtures accelerate your tests by wrapping each test method
7
- # in a transaction that's rolled back on completion. This ensures that the
8
- # test database remains unchanged so your fixtures don't have to be reloaded
9
- # between every test method. Fewer database queries means faster tests.
10
- #
11
- # Read Mike Clark's excellent walkthrough at
12
- # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
13
- #
14
- # Every Active Record database supports transactions except MyISAM tables
15
- # in MySQL. Turn off transactional fixtures in this case; however, if you
16
- # don't care one way or the other, switching from MyISAM to InnoDB tables
17
- # is recommended.
18
- #
19
- # The only drawback to using transactional fixtures is when you actually
20
- # need to test transactions. Since your test is bracketed by a transaction,
21
- # any transactions started in your code will be automatically rolled back.
22
- self.use_transactional_fixtures = true
23
-
24
- # Instantiated fixtures are slow, but give you @david where otherwise you
25
- # would need people(:david). If you don't want to migrate your existing
26
- # test cases which use the @david style and don't mind the speed hit (each
27
- # instantiated fixtures translates to a database query per test method),
28
- # then set this back to true.
29
- self.use_instantiated_fixtures = false
30
-
31
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
32
- #
33
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
34
- # -- they do not yet inherit this setting
35
- fixtures :all
36
-
37
- # Add more helper methods to be used by all tests here...
38
- end
@@ -1,4 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PostsHelperTest < ActionView::TestCase
4
- end
@@ -1,8 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PostTest < ActiveSupport::TestCase
4
- # Replace this with your real tests.
5
- test "the truth" do
6
- assert true
7
- end
8
- end
@@ -1,28 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'rails', '3.0.0.beta3'
4
-
5
- # Bundle edge Rails instead:
6
- # gem 'rails', :git => 'git://github.com/rails/rails.git'
7
-
8
- gem 'sqlite3-ruby', :require => 'sqlite3'
9
-
10
- # Use unicorn as the web server
11
- # gem 'unicorn'
12
-
13
- # Deploy with Capistrano
14
- # gem 'capistrano'
15
-
16
- # Bundle the extra gems:
17
- # gem 'bj'
18
- # gem 'nokogiri', '1.4.1'
19
- # gem 'sqlite3-ruby', :require => 'sqlite3'
20
- # gem 'aws-s3', :require => 'aws/s3'
21
-
22
- # Bundle gems for certain environments:
23
- # gem 'rspec', :group => :test
24
- # group :test do
25
- # gem 'webrat'
26
- # end
27
-
28
- gem "reflexive"
@@ -1,244 +0,0 @@
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" templates
7
- that are primarily responsible for inserting pre-built data in between HTML tags.
8
- The model contains the "smart" domain objects (such as Account, Product, Person,
9
- Post) that holds all the business logic and knows how to persist themselves to
10
- a database. The controller handles the incoming requests (such as Save New Account,
11
- Update Product, Show Post) by manipulating the model and directing data to the view.
12
-
13
- In Rails, the model is handled by what's called an object-relational mapping
14
- layer entitled Active Record. This layer allows you to present the data from
15
- database rows as objects and embellish these data objects with business logic
16
- methods. You can read more about Active Record in
17
- link:files/vendor/rails/activerecord/README.html.
18
-
19
- The controller and view are handled by the Action Pack, which handles both
20
- layers by its two parts: Action View and Action Controller. These two layers
21
- are bundled in a single package due to their heavy interdependence. This is
22
- unlike the relationship between the Active Record and Action Pack that is much
23
- more separate. Each of these packages can be used independently outside of
24
- Rails. You can read more about Action Pack in
25
- link:files/vendor/rails/actionpack/README.html.
26
-
27
-
28
- == Getting Started
29
-
30
- 1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
31
- and your application name. Ex: rails myapp
32
- 2. Change directory into myapp and start the web server: <tt>rails server</tt> (run with --help for options)
33
- 3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
34
- 4. Follow the guidelines to start developing your application
35
-
36
-
37
- == Web Servers
38
-
39
- By default, Rails will try to use Mongrel if it's installed when started with <tt>rails server</tt>, otherwise
40
- Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails
41
- with a variety of other web servers.
42
-
43
- Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
44
- suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
45
- getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
46
- More info at: http://mongrel.rubyforge.org
47
-
48
- Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
49
- Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
50
- FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
51
-
52
- == Apache .htaccess example for FCGI/CGI
53
-
54
- # General Apache options
55
- AddHandler fastcgi-script .fcgi
56
- AddHandler cgi-script .cgi
57
- Options +FollowSymLinks +ExecCGI
58
-
59
- # If you don't want Rails to look in certain directories,
60
- # use the following rewrite rules so that Apache won't rewrite certain requests
61
- #
62
- # Example:
63
- # RewriteCond %{REQUEST_URI} ^/notrails.*
64
- # RewriteRule .* - [L]
65
-
66
- # Redirect all requests not available on the filesystem to Rails
67
- # By default the cgi dispatcher is used which is very slow
68
- #
69
- # For better performance replace the dispatcher with the fastcgi one
70
- #
71
- # Example:
72
- # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
73
- RewriteEngine On
74
-
75
- # If your Rails application is accessed via an Alias directive,
76
- # then you MUST also set the RewriteBase in this htaccess file.
77
- #
78
- # Example:
79
- # Alias /myrailsapp /path/to/myrailsapp/public
80
- # RewriteBase /myrailsapp
81
-
82
- RewriteRule ^$ index.html [QSA]
83
- RewriteRule ^([^.]+)$ $1.html [QSA]
84
- RewriteCond %{REQUEST_FILENAME} !-f
85
- RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
86
-
87
- # In case Rails experiences terminal errors
88
- # Instead of displaying this message you can supply a file here which will be rendered instead
89
- #
90
- # Example:
91
- # ErrorDocument 500 /500.html
92
-
93
- ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
94
-
95
-
96
- == Debugging Rails
97
-
98
- Sometimes your application goes wrong. Fortunately there are a lot of tools that
99
- will help you debug it and get it back on the rails.
100
-
101
- First area to check is the application log files. Have "tail -f" commands running
102
- on the server.log and development.log. Rails will automatically display debugging
103
- and runtime information to these files. Debugging info will also be shown in the
104
- browser on requests from 127.0.0.1.
105
-
106
- You can also log your own messages directly into the log file from your code using
107
- the Ruby logger class from inside your controllers. Example:
108
-
109
- class WeblogController < ActionController::Base
110
- def destroy
111
- @weblog = Weblog.find(params[:id])
112
- @weblog.destroy
113
- logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
114
- end
115
- end
116
-
117
- The result will be a message in your log file along the lines of:
118
-
119
- Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
120
-
121
- More information on how to use the logger is at http://www.ruby-doc.org/core/
122
-
123
- Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
124
-
125
- * The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
126
- * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
127
-
128
- These two online (and free) books will bring you up to speed on the Ruby language
129
- and also on programming in general.
130
-
131
-
132
- == Debugger
133
-
134
- Debugger support is available through the debugger command when you start your Mongrel or
135
- Webrick server with --debugger. This means that you can break out of execution at any point
136
- in the code, investigate and change the model, AND then resume execution!
137
- You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
138
- Example:
139
-
140
- class WeblogController < ActionController::Base
141
- def index
142
- @posts = Post.find(:all)
143
- debugger
144
- end
145
- end
146
-
147
- So the controller will accept the action, run the first line, then present you
148
- with a IRB prompt in the server window. Here you can do things like:
149
-
150
- >> @posts.inspect
151
- => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
152
- #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
153
- >> @posts.first.title = "hello from a debugger"
154
- => "hello from a debugger"
155
-
156
- ...and even better is that you can examine how your runtime objects actually work:
157
-
158
- >> f = @posts.first
159
- => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
160
- >> f.
161
- Display all 152 possibilities? (y or n)
162
-
163
- Finally, when you're ready to resume execution, you enter "cont"
164
-
165
-
166
- == Console
167
-
168
- You can interact with the domain model by starting the console through <tt>rails console</tt>.
169
- Here you'll have all parts of the application configured, just like it is when the
170
- application is running. You can inspect domain models, change values, and save to the
171
- database. Starting the script without arguments will launch it in the development environment.
172
- Passing an argument will specify a different environment, like <tt>rails console production</tt>.
173
-
174
- To reload your controllers and models after launching the console run <tt>reload!</tt>
175
-
176
- == dbconsole
177
-
178
- You can go to the command line of your database directly through <tt>rails dbconsole</tt>.
179
- You would be connected to the database with the credentials defined in database.yml.
180
- Starting the script without arguments will connect you to the development database. Passing an
181
- argument will connect you to a different database, like <tt>rails dbconsole production</tt>.
182
- Currently works for mysql, postgresql and sqlite.
183
-
184
- == Description of Contents
185
-
186
- app
187
- Holds all the code that's specific to this particular application.
188
-
189
- app/controllers
190
- Holds controllers that should be named like weblogs_controller.rb for
191
- automated URL mapping. All controllers should descend from ApplicationController
192
- which itself descends from ActionController::Base.
193
-
194
- app/models
195
- Holds models that should be named like post.rb.
196
- Most models will descend from ActiveRecord::Base.
197
-
198
- app/views
199
- Holds the template files for the view that should be named like
200
- weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
201
- syntax.
202
-
203
- app/views/layouts
204
- Holds the template files for layouts to be used with views. This models the common
205
- header/footer method of wrapping views. In your views, define a layout using the
206
- <tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
207
- call <% yield %> to render the view using this layout.
208
-
209
- app/helpers
210
- Holds view helpers that should be named like weblogs_helper.rb. These are generated
211
- for you automatically when using rails generate for controllers. Helpers can be used to
212
- wrap functionality for your views into methods.
213
-
214
- config
215
- Configuration files for the Rails environment, the routing map, the database, and other dependencies.
216
-
217
- db
218
- Contains the database schema in schema.rb. db/migrate contains all
219
- the sequence of Migrations for your schema.
220
-
221
- doc
222
- This directory is where your application documentation will be stored when generated
223
- using <tt>rake doc:app</tt>
224
-
225
- lib
226
- Application specific libraries. Basically, any kind of custom code that doesn't
227
- belong under controllers, models, or helpers. This directory is in the load path.
228
-
229
- public
230
- The directory available for the web server. Contains subdirectories for images, stylesheets,
231
- and javascripts. Also contains the dispatchers and the default HTML files. This should be
232
- set as the DOCUMENT_ROOT of your web server.
233
-
234
- script
235
- Helper scripts for automation and generation.
236
-
237
- test
238
- Unit and functional tests along with fixtures. When using the rails generate command, template
239
- test files will be generated for you and placed in this directory.
240
-
241
- vendor
242
- External libraries that the application depends on. Also includes the plugins subdirectory.
243
- If the app has frozen rails, those gems also go here, under vendor/rails/.
244
- This directory is in the load path.
@@ -1,10 +0,0 @@
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
-
6
- require 'rake'
7
- require 'rake/testtask'
8
- require 'rake/rdoctask'
9
-
10
- Rails::Application.load_tasks
@@ -1,4 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- protect_from_forgery
3
- layout 'application'
4
- end
@@ -1,83 +0,0 @@
1
- class PostsController < ApplicationController
2
- # GET /posts
3
- # GET /posts.xml
4
- def index
5
- @posts = Post.all
6
-
7
- respond_to do |format|
8
- format.html # index.html.erb
9
- format.xml { render :xml => @posts }
10
- end
11
- end
12
-
13
- # GET /posts/1
14
- # GET /posts/1.xml
15
- def show
16
- @post = Post.find(params[:id])
17
-
18
- respond_to do |format|
19
- format.html # show.html.erb
20
- format.xml { render :xml => @post }
21
- end
22
- end
23
-
24
- # GET /posts/new
25
- # GET /posts/new.xml
26
- def new
27
- @post = Post.new
28
-
29
- respond_to do |format|
30
- format.html # new.html.erb
31
- format.xml { render :xml => @post }
32
- end
33
- end
34
-
35
- # GET /posts/1/edit
36
- def edit
37
- @post = Post.find(params[:id])
38
- end
39
-
40
- # POST /posts
41
- # POST /posts.xml
42
- def create
43
- @post = Post.new(params[:post])
44
-
45
- respond_to do |format|
46
- if @post.save
47
- format.html { redirect_to(@post, :notice => 'Post was successfully created.') }
48
- format.xml { render :xml => @post, :status => :created, :location => @post }
49
- else
50
- format.html { render :action => "new" }
51
- format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
52
- end
53
- end
54
- end
55
-
56
- # PUT /posts/1
57
- # PUT /posts/1.xml
58
- def update
59
- @post = Post.find(params[:id])
60
-
61
- respond_to do |format|
62
- if @post.update_attributes(params[:post])
63
- format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }
64
- format.xml { head :ok }
65
- else
66
- format.html { render :action => "edit" }
67
- format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
68
- end
69
- end
70
- end
71
-
72
- # DELETE /posts/1
73
- # DELETE /posts/1.xml
74
- def destroy
75
- @post = Post.find(params[:id])
76
- @post.destroy
77
-
78
- respond_to do |format|
79
- format.html { redirect_to(posts_url) }
80
- format.xml { head :ok }
81
- end
82
- end
83
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,2 +0,0 @@
1
- module PostsHelper
2
- end
@@ -1,2 +0,0 @@
1
- class Post < ActiveRecord::Base
2
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Rails3TestApp</title>
5
- <%= stylesheet_link_tag :all %>
6
- <%= javascript_include_tag :defaults %>
7
- <%= csrf_meta_tag %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,16 +0,0 @@
1
- <%= form_for(@post) do |f| %>
2
- <% if @post.errors.any? %>
3
- <div id="errorExplanation">
4
- <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
5
- <ul>
6
- <% @post.errors.full_messages.each do |msg| %>
7
- <li><%= msg %></li>
8
- <% end %>
9
- </ul>
10
- </div>
11
- <% end %>
12
-
13
- <div class="actions">
14
- <%= f.submit %>
15
- </div>
16
- <% end %>
@@ -1,6 +0,0 @@
1
- <h1>Editing post</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Show', @post %> |
6
- <%= link_to 'Back', posts_path %>