the_sortable_tree 2.6.1 → 2.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -5
  3. data/app/assets/javascripts/{expandable_tree → the_sortable_tree/expandable_tree}/hashchange.js.coffee +0 -0
  4. data/app/assets/javascripts/{expandable_tree → the_sortable_tree/expandable_tree}/initializer.js.coffee +0 -0
  5. data/app/assets/javascripts/{expandable_tree → the_sortable_tree/expandable_tree}/jquery.cookie.coffee +0 -0
  6. data/app/assets/javascripts/{expandable_tree → the_sortable_tree/expandable_tree}/restorable.js.coffee +0 -0
  7. data/app/assets/javascripts/{jquery.ui.nestedSortable.js → the_sortable_tree/jquery.ui.nestedSortable.js} +0 -0
  8. data/app/assets/javascripts/the_sortable_tree/sortable_ui/base.js.coffee +87 -0
  9. data/app/assets/javascripts/{sortable_tree → the_sortable_tree/sortable_ui}/initializer.js.coffee +14 -11
  10. data/app/assets/stylesheets/the_sortable_tree/expandable_tree.sass +23 -0
  11. data/app/assets/stylesheets/the_sortable_tree/sortable_ui/base.sass +36 -0
  12. data/app/assets/stylesheets/the_sortable_tree/tree.sass +35 -0
  13. data/app/helpers/render_expandable_tree_helper.rb +3 -3
  14. data/app/helpers/render_sortable_tree_helper.rb +30 -12
  15. data/app/helpers/render_tree_helper.rb +6 -5
  16. data/app/helpers/the_sortable_tree_helper.rb +3 -3
  17. data/gem_version.rb +1 -1
  18. data/spec/dummy_app/Gemfile +6 -3
  19. data/spec/dummy_app/README.md +26 -36
  20. data/spec/dummy_app/app/assets/javascripts/application.js +9 -13
  21. data/spec/dummy_app/app/assets/stylesheets/application.css +8 -9
  22. data/spec/dummy_app/app/views/admin/pages/index.html.haml +1 -3
  23. data/spec/dummy_app/app/views/admin/pages/manage.html.haml +2 -2
  24. data/spec/dummy_app/app/views/admin/pages/namespaced_link.html.haml +1 -1
  25. data/spec/dummy_app/app/views/admin/pages/node_manage.html.haml +1 -1
  26. data/spec/dummy_app/app/views/article_categories/index.html.haml +1 -1
  27. data/spec/dummy_app/app/views/article_categories/manage.html.haml +1 -1
  28. data/spec/dummy_app/app/views/inventory/categories/index.html.haml +1 -2
  29. data/spec/dummy_app/app/views/inventory/categories/manage.html.haml +1 -1
  30. data/spec/dummy_app/app/views/layouts/application.html.erb +5 -1
  31. data/spec/dummy_app/app/views/pages/expand.html.haml +1 -1
  32. data/spec/dummy_app/app/views/pages/expand_node.html.haml +1 -1
  33. data/spec/dummy_app/app/views/pages/index.html.haml +1 -2
  34. data/spec/dummy_app/app/views/pages/manage.html.haml +7 -6
  35. data/spec/dummy_app/app/views/pages/nested_options.html.haml +3 -2
  36. data/spec/dummy_app/app/views/welcome/index.html.haml +30 -29
  37. data/spec/dummy_app/bin/bundler +17 -0
  38. data/spec/dummy_app/bin/coderay +17 -0
  39. data/spec/dummy_app/bin/erubis +17 -0
  40. data/spec/dummy_app/bin/haml +17 -0
  41. data/spec/dummy_app/bin/html2haml +17 -0
  42. data/spec/dummy_app/bin/htmldiff +17 -0
  43. data/spec/dummy_app/bin/ldiff +17 -0
  44. data/spec/dummy_app/bin/nokogiri +17 -0
  45. data/spec/dummy_app/bin/pry +17 -0
  46. data/spec/dummy_app/bin/rackup +17 -0
  47. data/spec/dummy_app/bin/rails +17 -0
  48. data/spec/dummy_app/bin/rake +17 -0
  49. data/spec/dummy_app/bin/rspec +17 -0
  50. data/spec/dummy_app/bin/ruby_parse +17 -0
  51. data/spec/dummy_app/bin/ruby_parse_extract_error +17 -0
  52. data/spec/dummy_app/bin/sass +17 -0
  53. data/spec/dummy_app/bin/sass-convert +17 -0
  54. data/spec/dummy_app/bin/scss +17 -0
  55. data/spec/dummy_app/bin/sprockets +17 -0
  56. data/spec/dummy_app/bin/thor +17 -0
  57. data/spec/dummy_app/bin/tilt +17 -0
  58. metadata +55 -121
  59. data/app/assets/stylesheets/expandable_tree.scss +0 -26
  60. data/app/assets/stylesheets/nested_options.scss +0 -25
  61. data/app/assets/stylesheets/sortable_tree.scss +0 -108
  62. data/app/assets/stylesheets/tree.scss +0 -35
  63. data/app/views/sortable/client/_tree.html.erb +0 -9
  64. data/app/views/tree/client/_tree.html.erb +0 -23
  65. data/spec/dummy_app/Gemfile.lock +0 -210
  66. data/spec/dummy_app/_test/fixtures/admin/pages.yml +0 -7
  67. data/spec/dummy_app/_test/fixtures/article_categories.yml +0 -9
  68. data/spec/dummy_app/_test/fixtures/comments.yml +0 -13
  69. data/spec/dummy_app/_test/fixtures/inventory/categories.yml +0 -9
  70. data/spec/dummy_app/_test/functional/inventory/category_controller_test.rb +0 -14
  71. data/spec/dummy_app/_test/performance/browsing_test.rb +0 -12
  72. data/spec/dummy_app/_test/test_helper.rb +0 -13
  73. data/spec/dummy_app/_test/unit/admin/page_test.rb +0 -7
  74. data/spec/dummy_app/_test/unit/article_category_test.rb +0 -7
  75. data/spec/dummy_app/_test/unit/comment_test.rb +0 -7
  76. data/spec/dummy_app/_test/unit/helpers/inventory/category_helper_test.rb +0 -4
  77. data/spec/dummy_app/_test/unit/inventory/category_test.rb +0 -7
  78. data/spec/dummy_app/config/database.yml +0 -7
  79. data/spec/dummy_app/db/development.db +0 -0
  80. data/spec/dummy_app/db/test.db +0 -0
  81. data/spec/dummy_app/doc/README_FOR_APP +0 -2
  82. data/spec/dummy_app/script/rails +0 -6
  83. data/spec/dummy_app/spec/build_tree_helper.rb +0 -39
  84. data/spec/dummy_app/spec/spec_helper.rb +0 -52
  85. data/spec/dummy_app/spec/views/pages/index.html.haml_spec.rb +0 -48
  86. data/spec/old_tests/controlllers/controller_mixin_spec.rb +0 -49
  87. data/spec/old_tests/dummy/README.rdoc +0 -261
  88. data/spec/old_tests/dummy/Rakefile +0 -7
  89. data/spec/old_tests/dummy/app/assets/javascripts/application.js +0 -15
  90. data/spec/old_tests/dummy/app/assets/stylesheets/application.css +0 -13
  91. data/spec/old_tests/dummy/app/controllers/application_controller.rb +0 -3
  92. data/spec/old_tests/dummy/app/controllers/tests_controller.rb +0 -3
  93. data/spec/old_tests/dummy/app/views/layouts/application.html.erb +0 -14
  94. data/spec/old_tests/dummy/config.ru +0 -4
  95. data/spec/old_tests/dummy/config/application.rb +0 -56
  96. data/spec/old_tests/dummy/config/boot.rb +0 -10
  97. data/spec/old_tests/dummy/config/database.yml +0 -25
  98. data/spec/old_tests/dummy/config/environment.rb +0 -5
  99. data/spec/old_tests/dummy/config/environments/development.rb +0 -37
  100. data/spec/old_tests/dummy/config/environments/production.rb +0 -67
  101. data/spec/old_tests/dummy/config/environments/test.rb +0 -37
  102. data/spec/old_tests/dummy/config/initializers/backtrace_silencers.rb +0 -7
  103. data/spec/old_tests/dummy/config/initializers/inflections.rb +0 -15
  104. data/spec/old_tests/dummy/config/initializers/mime_types.rb +0 -5
  105. data/spec/old_tests/dummy/config/initializers/secret_token.rb +0 -7
  106. data/spec/old_tests/dummy/config/initializers/session_store.rb +0 -8
  107. data/spec/old_tests/dummy/config/initializers/wrap_parameters.rb +0 -14
  108. data/spec/old_tests/dummy/config/locales/en.yml +0 -5
  109. data/spec/old_tests/dummy/config/routes.rb +0 -3
  110. data/spec/old_tests/dummy/db/test.sqlite3 +0 -0
  111. data/spec/old_tests/dummy/log/test.log +0 -4
  112. data/spec/old_tests/dummy/public/404.html +0 -26
  113. data/spec/old_tests/dummy/public/422.html +0 -26
  114. data/spec/old_tests/dummy/public/500.html +0 -25
  115. data/spec/old_tests/dummy/public/favicon.ico +0 -0
  116. data/spec/old_tests/dummy/script/rails +0 -6
  117. data/spec/old_tests/spec_helper.rb +0 -15
@@ -1,9 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
2
-
3
- one:
4
- title: MyString
5
- content: MyText
6
-
7
- two:
8
- title: MyString
9
- content: MyText
@@ -1,13 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
2
-
3
- one:
4
- name: MyString
5
- email: MyString
6
- raw_content: MyText
7
- content: MyText
8
-
9
- two:
10
- name: MyString
11
- email: MyString
12
- raw_content: MyText
13
- content: MyText
@@ -1,9 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
2
-
3
- one:
4
- title: MyString
5
- content: MyText
6
-
7
- two:
8
- title: MyString
9
- content: MyText
@@ -1,14 +0,0 @@
1
- require 'test_helper'
2
-
3
- class Inventory::CategoryControllerTest < ActionController::TestCase
4
- test "should get index" do
5
- get :index
6
- assert_response :success
7
- end
8
-
9
- test "should get manage" do
10
- get :manage
11
- assert_response :success
12
- end
13
-
14
- end
@@ -1,12 +0,0 @@
1
- require 'test_helper'
2
- require 'rails/performance_test_help'
3
-
4
- class BrowsingTest < ActionDispatch::PerformanceTest
5
- # Refer to the documentation for all available options
6
- # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
7
- # :output => 'tmp/performance', :formats => [:flat] }
8
-
9
- def test_homepage
10
- get '/'
11
- end
12
- end
@@ -1,13 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path('../../config/environment', __FILE__)
3
- require 'rails/test_help'
4
-
5
- class ActiveSupport::TestCase
6
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
- #
8
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
- # -- they do not yet inherit this setting
10
- fixtures :all
11
-
12
- # Add more helper methods to be used by all tests here...
13
- end
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class Admin::PageTest < ActiveSupport::TestCase
4
- # test "the truth" do
5
- # assert true
6
- # end
7
- end
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ArticleCategoryTest < ActiveSupport::TestCase
4
- # test "the truth" do
5
- # assert true
6
- # end
7
- end
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class CommentTest < ActiveSupport::TestCase
4
- # test "the truth" do
5
- # assert true
6
- # end
7
- end
@@ -1,4 +0,0 @@
1
- require 'test_helper'
2
-
3
- class Inventory::CategoryHelperTest < ActionView::TestCase
4
- end
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class Inventory::CategoryTest < ActiveSupport::TestCase
4
- # test "the truth" do
5
- # assert true
6
- # end
7
- end
@@ -1,7 +0,0 @@
1
- development:
2
- adapter: sqlite3
3
- database: db/development.db
4
-
5
- test:
6
- adapter: sqlite3
7
- database: db/test.db
Binary file
File without changes
@@ -1,2 +0,0 @@
1
- Use this README file to introduce your application and point to useful places in the API for learning more.
2
- Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
@@ -1,39 +0,0 @@
1
- def build_test_tree klass = Page, count = 5
2
- basic_content = "Hello World!"
3
- counter = 0
4
-
5
- count.times do |book_i|
6
- var = klass.new
7
- var.title = "Book #{book_i}"
8
- var.content = basic_content + Faker::Lorem.sentence(5)
9
- var.save
10
-
11
- counter = counter.next
12
- puts '.' + counter.to_s
13
-
14
- count.times do |chapter_i|
15
- var1 = klass.new
16
- var1.title = "Chapter #{chapter_i}"
17
- var1.content = basic_content + Faker::Lorem.sentence(5)
18
- var1.save
19
- var1.move_to_child_of var
20
-
21
- counter = counter.next
22
- puts '..' + counter.to_s
23
-
24
- count.times do |page_i|
25
- var2 = klass.new
26
- var2.title = "Page #{page_i}"
27
- var2.content = basic_content + Faker::Lorem.sentence(25)
28
- var2.save
29
-
30
- var2.move_to_child_of var1
31
- counter = counter.next
32
- puts '...' + counter.to_s
33
- end
34
- end
35
- end
36
-
37
- puts klass.to_s
38
- puts klass.count
39
- end
@@ -1,52 +0,0 @@
1
- # This file is copied to spec/ when you run 'rails generate rspec:install'
2
- ENV["RAILS_ENV"] ||= 'test'
3
- require File.expand_path("../../config/environment", __FILE__)
4
- require 'rspec/rails'
5
- require 'rspec/autorun'
6
-
7
- require 'capybara/rails'
8
-
9
- # Requires supporting ruby files with custom matchers and macros, etc,
10
- # in spec/support/ and its subdirectories.
11
- Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
12
-
13
- # Checks for pending migrations before tests are run.
14
- # If you are not using ActiveRecord, you can remove this line.
15
- ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
16
-
17
- Capybara.configure do |config|
18
- # config.default_wait_time = 2
19
- # config.app_host = '127.0.0.1'
20
- config.server_port = 3111
21
- end
22
-
23
- RSpec.configure do |config|
24
- Capybara.default_driver = :selenium
25
-
26
- # ## Mock Framework
27
- #
28
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
29
- #
30
- # config.mock_with :mocha
31
- # config.mock_with :flexmock
32
- # config.mock_with :rr
33
-
34
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
35
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
36
-
37
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
38
- # examples within a transaction, remove the following line or assign false
39
- # instead of true.
40
- config.use_transactional_fixtures = true
41
-
42
- # If true, the base class of anonymous controllers will be inferred
43
- # automatically. This will be the default behavior in future versions of
44
- # rspec-rails.
45
- config.infer_base_class_for_anonymous_controllers = false
46
-
47
- # Run specs in random order to surface order dependencies. If you find an
48
- # order dependency and want to debug it, you can fix the order by providing
49
- # the seed, which is printed after each run.
50
- # --seed 1234
51
- config.order = "random"
52
- end
@@ -1,48 +0,0 @@
1
- require 'spec_helper'
2
- require 'build_tree_helper'
3
-
4
- describe "pages/index" do
5
- include Capybara::DSL
6
-
7
- before(:all) do
8
- Benchmark.bm do |b|
9
- b.report{
10
- Page.all.each{|p| begin; p.destroy; rescue; end; }
11
- }
12
- end
13
- puts "DB Cleaning"
14
-
15
- # sleep 3
16
-
17
- # 5 => 155
18
- # 6 => 258
19
- # 7 => 399
20
- # 8 => 584
21
- # 9 => 819
22
- # 10 => 1110
23
- Benchmark.bm do |b|
24
- b.report{
25
- build_test_tree Page, 10
26
- }
27
- end
28
- puts "Tree Building"
29
-
30
- end
31
-
32
- it "render all pages without capybara" do
33
- assign :pages, Page.all
34
- render
35
- end
36
-
37
- it "pages/index" do
38
- visit '/pages'
39
- nodes = all('li', visible: true)
40
- nodes.count.should be 15
41
- end
42
-
43
- it "pages/manage all pages" do
44
- visit '/pages/manage'
45
- nodes = all('li', visible: true)
46
- nodes.count.should be 1110
47
- end
48
- end
@@ -1,49 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe TheSortableTreeController do
4
- describe "common variable definitions" do
5
- class BigTest; end
6
-
7
- module ParentModule
8
- class TestsController < ApplicationController
9
- include TheSortableTreeController::Rebuild
10
- end
11
-
12
- class BigTestsController < ApplicationController
13
- include TheSortableTreeController::Rebuild
14
- end
15
- end
16
-
17
- before do
18
- @test_controller = TestsController.new
19
- @variable, @collection, @klass = @test_controller.the_define_common_variables
20
- end
21
-
22
- it "should define collection" do
23
- @collection.should == 'tests'
24
- end
25
-
26
- describe "namespaced controllers" do
27
- before do
28
- @test_controller = ParentModule::TestsController.new
29
- @variable, @collection, @klass = @test_controller.the_define_common_variables
30
- end
31
-
32
- it "should handle namespaced collections" do
33
- @collection.should == 'tests'
34
- end
35
-
36
- end
37
-
38
- describe "camel cased and namespaced controllers" do
39
- before do
40
- @test_controller = ParentModule::BigTestsController.new
41
- @variable, @collection, @klass = @test_controller.the_define_common_variables
42
- end
43
-
44
- it "should handle namespaced collections" do
45
- @collection.should == 'big_tests'
46
- end
47
- end
48
- end
49
- end
@@ -1,261 +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"
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.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.org/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
- | |-- assets
160
- | |-- images
161
- | |-- javascripts
162
- | `-- stylesheets
163
- | |-- controllers
164
- | |-- helpers
165
- | |-- mailers
166
- | |-- models
167
- | `-- views
168
- | `-- layouts
169
- |-- config
170
- | |-- environments
171
- | |-- initializers
172
- | `-- locales
173
- |-- db
174
- |-- doc
175
- |-- lib
176
- | `-- tasks
177
- |-- log
178
- |-- public
179
- |-- script
180
- |-- test
181
- | |-- fixtures
182
- | |-- functional
183
- | |-- integration
184
- | |-- performance
185
- | `-- unit
186
- |-- tmp
187
- | |-- cache
188
- | |-- pids
189
- | |-- sessions
190
- | `-- sockets
191
- `-- vendor
192
- |-- assets
193
- `-- stylesheets
194
- `-- plugins
195
-
196
- app
197
- Holds all the code that's specific to this particular application.
198
-
199
- app/assets
200
- Contains subdirectories for images, stylesheets, and JavaScript files.
201
-
202
- app/controllers
203
- Holds controllers that should be named like weblogs_controller.rb for
204
- automated URL mapping. All controllers should descend from
205
- ApplicationController which itself descends from ActionController::Base.
206
-
207
- app/models
208
- Holds models that should be named like post.rb. Models descend from
209
- ActiveRecord::Base by default.
210
-
211
- app/views
212
- Holds the template files for the view that should be named like
213
- weblogs/index.html.erb for the WeblogsController#index action. All views use
214
- eRuby syntax by default.
215
-
216
- app/views/layouts
217
- Holds the template files for layouts to be used with views. This models the
218
- common header/footer method of wrapping views. In your views, define a layout
219
- using the <tt>layout :default</tt> and create a file named default.html.erb.
220
- Inside default.html.erb, call <% yield %> to render the view using this
221
- layout.
222
-
223
- app/helpers
224
- Holds view helpers that should be named like weblogs_helper.rb. These are
225
- generated for you automatically when using generators for controllers.
226
- Helpers can be used to wrap functionality for your views into methods.
227
-
228
- config
229
- Configuration files for the Rails environment, the routing map, the database,
230
- and other dependencies.
231
-
232
- db
233
- Contains the database schema in schema.rb. db/migrate contains all the
234
- sequence of Migrations for your schema.
235
-
236
- doc
237
- This directory is where your application documentation will be stored when
238
- generated using <tt>rake doc:app</tt>
239
-
240
- lib
241
- Application specific libraries. Basically, any kind of custom code that
242
- doesn't belong under controllers, models, or helpers. This directory is in
243
- the load path.
244
-
245
- public
246
- The directory available for the web server. Also contains the dispatchers and the
247
- default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
- server.
249
-
250
- script
251
- Helper scripts for automation and generation.
252
-
253
- test
254
- Unit and functional tests along with fixtures. When using the rails generate
255
- command, template test files will be generated for you and placed in this
256
- directory.
257
-
258
- vendor
259
- External libraries that the application depends on. Also includes the plugins
260
- subdirectory. If the app has frozen rails, those gems also go here, under
261
- vendor/rails/. This directory is in the load path.