formatted_form 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/Gemfile +1 -5
- data/LICENSE +1 -1
- data/README.md +1 -0
- data/Rakefile +7 -28
- data/app/views/formatted_form/_url_field.html.erb +1 -0
- data/formatted_form.gemspec +18 -111
- data/lib/formatted_form.rb +1 -0
- data/lib/formatted_form/engine.rb +1 -0
- data/lib/formatted_form/form_builder.rb +14 -3
- data/lib/formatted_form/version.rb +3 -0
- data/test/dummy/README.rdoc +15 -248
- data/test/dummy/Rakefile +0 -1
- data/test/dummy/app/{mailers/.gitkeep → assets/images/.keep} +0 -0
- data/test/dummy/app/assets/javascripts/application.js +3 -3
- data/test/dummy/app/controllers/application_controller.rb +0 -17
- data/test/dummy/app/models/{.gitkeep → .keep} +0 -0
- data/test/dummy/app/models/user.rb +16 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +1 -1
- data/test/dummy/config/application.rb +2 -38
- data/test/dummy/config/boot.rb +4 -9
- data/test/dummy/config/environment.rb +2 -2
- data/test/dummy/config/environments/development.rb +9 -13
- data/test/dummy/config/environments/production.rb +40 -24
- data/test/dummy/config/environments/test.rb +13 -12
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +6 -5
- data/test/dummy/config/initializers/secret_token.rb +7 -2
- data/test/dummy/config/initializers/session_store.rb +0 -5
- data/test/dummy/config/initializers/wrap_parameters.rb +2 -3
- data/test/dummy/config/routes.rb +0 -56
- data/test/form_builder_test.rb +8 -2
- data/test/test_helper.rb +1 -1
- metadata +22 -49
- data/VERSION +0 -1
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: 75d53d80662778921abb2a02091aeb8ffe9ee4cd
|
4
|
+
data.tar.gz: fe54d9def669ead261ba7aa135de403721ca223b
|
5
|
+
!binary "U0hBNTEy":
|
6
|
+
metadata.gz: 0478db0fa519c2089b0915ea04279405dcaad256039c41b17f6639e42ad5568e21d0c8f9ed2ad21dfa919609e365e71a9035bcf6bba97afc30a00b1f581ca795
|
7
|
+
data.tar.gz: 67116117498ab93ee9007ebf93e1d305641e1fe7636c33d7de98af0e4ca72c032605305d834937cbbc0e3f5452557eab9d8d85bcb604d1674b3656fa822fe01a
|
data/.gitignore
ADDED
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -37,6 +37,7 @@ Use `formatted_form_for` when you want to render a form with Bootstrap markup.
|
|
37
37
|
= f.phone_field :phone
|
38
38
|
= f.password_field :password
|
39
39
|
= f.password_field :password_confirmation
|
40
|
+
= f.url_field :homepage
|
40
41
|
= f.select :role, User::ROLES
|
41
42
|
= f.time_zone_select :time_zone
|
42
43
|
= f.check_box :reminder, :label => 'Send Daily Reminder?'
|
data/Rakefile
CHANGED
@@ -1,33 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
rescue LoadError
|
4
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
-
end
|
1
|
+
require 'bundler'
|
2
|
+
require 'rake/testtask'
|
6
3
|
|
7
|
-
require
|
8
|
-
require 'rake'
|
4
|
+
Bundler.require
|
9
5
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
gem.homepage = "http://github.com/twg/formatted_form"
|
15
|
-
gem.license = "MIT"
|
16
|
-
gem.summary = "A Rails form builder that generates Twitter Bootstrap markup and helps keep your code clean"
|
17
|
-
gem.description = ''
|
18
|
-
gem.email = "jack@twg.ca"
|
19
|
-
gem.authors = ["Jack Neto", 'Oleg Khabarov', 'The Working Group Inc.']
|
20
|
-
end
|
21
|
-
Jeweler::RubygemsDotOrgTasks.new
|
22
|
-
rescue LoadError
|
23
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
6
|
+
Rake::TestTask.new(:test) do |test|
|
7
|
+
test.libs << 'lib' << 'test'
|
8
|
+
test.pattern = 'test/**/*_test.rb'
|
9
|
+
test.verbose = true
|
24
10
|
end
|
25
11
|
|
26
|
-
require 'rake/testtask'
|
27
|
-
Rake::TestTask.new(:test) do |t|
|
28
|
-
t.libs << 'lib'
|
29
|
-
t.libs << 'test'
|
30
|
-
t.pattern = 'test/**/*_test.rb'
|
31
|
-
t.verbose = false
|
32
|
-
end
|
33
12
|
task :default => :test
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => 'formatted_form/templates/field', :locals => { :options => options } %>
|
data/formatted_form.gemspec
CHANGED
@@ -1,115 +1,22 @@
|
|
1
|
-
#
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
1
|
+
# encoding: utf-8
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
s.version = "2.1.1"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Jack Neto", "Oleg Khabarov", "The Working Group Inc."]
|
12
|
-
s.date = "2013-02-20"
|
13
|
-
s.description = ""
|
14
|
-
s.email = "jack@twg.ca"
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.md"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
"Gemfile",
|
21
|
-
"LICENSE",
|
22
|
-
"README.md",
|
23
|
-
"Rakefile",
|
24
|
-
"VERSION",
|
25
|
-
"app/assets/javascripts/formatted_form.js",
|
26
|
-
"app/assets/stylesheets/formatted_form.css",
|
27
|
-
"app/views/formatted_form/_check_box.html.erb",
|
28
|
-
"app/views/formatted_form/_date_select.html.erb",
|
29
|
-
"app/views/formatted_form/_datetime_select.html.erb",
|
30
|
-
"app/views/formatted_form/_element.html.erb",
|
31
|
-
"app/views/formatted_form/_email_field.html.erb",
|
32
|
-
"app/views/formatted_form/_file_field.html.erb",
|
33
|
-
"app/views/formatted_form/_number_field.html.erb",
|
34
|
-
"app/views/formatted_form/_password_field.html.erb",
|
35
|
-
"app/views/formatted_form/_phone_field.html.erb",
|
36
|
-
"app/views/formatted_form/_radio_button.html.erb",
|
37
|
-
"app/views/formatted_form/_range_field.html.erb",
|
38
|
-
"app/views/formatted_form/_search_field.html.erb",
|
39
|
-
"app/views/formatted_form/_select.html.erb",
|
40
|
-
"app/views/formatted_form/_submit.html.erb",
|
41
|
-
"app/views/formatted_form/_telephone_field.html.erb",
|
42
|
-
"app/views/formatted_form/_text_area.html.erb",
|
43
|
-
"app/views/formatted_form/_text_field.html.erb",
|
44
|
-
"app/views/formatted_form/_time_select.html.erb",
|
45
|
-
"app/views/formatted_form/_time_zone_select.html.erb",
|
46
|
-
"app/views/formatted_form/templates/_choices.html.erb",
|
47
|
-
"app/views/formatted_form/templates/_choices_block.html.erb",
|
48
|
-
"app/views/formatted_form/templates/_choices_inline.html.erb",
|
49
|
-
"app/views/formatted_form/templates/_field.html.erb",
|
50
|
-
"app/views/formatted_form/templates/_field_block.html.erb",
|
51
|
-
"app/views/formatted_form/templates/_field_inline.html.erb",
|
52
|
-
"app/views/formatted_form/templates/_label.html.erb",
|
53
|
-
"formatted_form.gemspec",
|
54
|
-
"lib/formatted_form.rb",
|
55
|
-
"lib/formatted_form/engine.rb",
|
56
|
-
"lib/formatted_form/form_builder.rb",
|
57
|
-
"lib/formatted_form/view_helper.rb",
|
58
|
-
"test/dummy/README.rdoc",
|
59
|
-
"test/dummy/Rakefile",
|
60
|
-
"test/dummy/app/assets/javascripts/application.js",
|
61
|
-
"test/dummy/app/assets/stylesheets/application.css",
|
62
|
-
"test/dummy/app/assets/stylesheets/bootstrap.css",
|
63
|
-
"test/dummy/app/controllers/application_controller.rb",
|
64
|
-
"test/dummy/app/helpers/application_helper.rb",
|
65
|
-
"test/dummy/app/mailers/.gitkeep",
|
66
|
-
"test/dummy/app/models/.gitkeep",
|
67
|
-
"test/dummy/app/views/application/test.html.erb",
|
68
|
-
"test/dummy/app/views/layouts/application.html.erb",
|
69
|
-
"test/dummy/config.ru",
|
70
|
-
"test/dummy/config/application.rb",
|
71
|
-
"test/dummy/config/boot.rb",
|
72
|
-
"test/dummy/config/environment.rb",
|
73
|
-
"test/dummy/config/environments/development.rb",
|
74
|
-
"test/dummy/config/environments/production.rb",
|
75
|
-
"test/dummy/config/environments/test.rb",
|
76
|
-
"test/dummy/config/initializers/backtrace_silencers.rb",
|
77
|
-
"test/dummy/config/initializers/inflections.rb",
|
78
|
-
"test/dummy/config/initializers/mime_types.rb",
|
79
|
-
"test/dummy/config/initializers/secret_token.rb",
|
80
|
-
"test/dummy/config/initializers/session_store.rb",
|
81
|
-
"test/dummy/config/initializers/wrap_parameters.rb",
|
82
|
-
"test/dummy/config/locales/en.yml",
|
83
|
-
"test/dummy/config/routes.rb",
|
84
|
-
"test/dummy/lib/assets/.gitkeep",
|
85
|
-
"test/dummy/log/.gitkeep",
|
86
|
-
"test/dummy/public/404.html",
|
87
|
-
"test/dummy/public/422.html",
|
88
|
-
"test/dummy/public/500.html",
|
89
|
-
"test/dummy/public/favicon.ico",
|
90
|
-
"test/dummy/script/rails",
|
91
|
-
"test/form_builder_test.rb",
|
92
|
-
"test/test_helper.rb"
|
93
|
-
]
|
94
|
-
s.homepage = "http://github.com/twg/formatted_form"
|
95
|
-
s.licenses = ["MIT"]
|
96
|
-
s.require_paths = ["lib"]
|
97
|
-
s.rubygems_version = "1.8.23"
|
98
|
-
s.summary = "A Rails form builder that generates Twitter Bootstrap markup and helps keep your code clean"
|
3
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
4
|
+
require 'formatted_form/version'
|
99
5
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "formatted_form"
|
8
|
+
s.version = FormattedForm::VERSION
|
9
|
+
s.authors = ["Jack Neto", "Oleg Khabarov", "The Working Group Inc."]
|
10
|
+
s.email = ["jack@twg.ca"]
|
11
|
+
s.homepage = "http://github.com/twg/formatted_form"
|
12
|
+
s.summary = "Rails form helper the generates Bootstrap 2 markup"
|
13
|
+
s.description = "Rails form helper the generates Bootstrap 2 markup"
|
14
|
+
s.license = "MIT"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.platform = Gem::Platform::RUBY
|
18
|
+
s.require_paths = ['lib']
|
19
|
+
|
20
|
+
s.add_dependency 'rails', '>= 3.1'
|
114
21
|
end
|
115
22
|
|
data/lib/formatted_form.rb
CHANGED
@@ -2,7 +2,7 @@ class FormattedForm::FormBuilder < ActionView::Helpers::FormBuilder
|
|
2
2
|
|
3
3
|
%w(
|
4
4
|
text_field password_field email_field telephone_field number_field
|
5
|
-
text_area file_field range_field search_field
|
5
|
+
text_area file_field range_field search_field url_field
|
6
6
|
).each do |field_name|
|
7
7
|
define_method field_name do |method, *args|
|
8
8
|
options = args.detect { |a| a.is_a?(Hash) } || {}
|
@@ -13,7 +13,7 @@ class FormattedForm::FormBuilder < ActionView::Helpers::FormBuilder
|
|
13
13
|
end
|
14
14
|
|
15
15
|
%w(
|
16
|
-
datetime_select date_select time_select
|
16
|
+
datetime_select date_select time_select
|
17
17
|
).each do |field_name|
|
18
18
|
define_method field_name do |method, options = {}, html_options = {}|
|
19
19
|
default_field(field_name, method, options) do
|
@@ -21,6 +21,16 @@ class FormattedForm::FormBuilder < ActionView::Helpers::FormBuilder
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
%w(
|
26
|
+
time_zone_select
|
27
|
+
).each do |field_name|
|
28
|
+
define_method field_name do |method, options = nil, html_options = {}|
|
29
|
+
default_field(field_name, method, options) do
|
30
|
+
super(method, options)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
24
34
|
|
25
35
|
# Wrapper for the select field
|
26
36
|
def select(method, choices, options = {}, html_options = {})
|
@@ -92,7 +102,8 @@ class FormattedForm::FormBuilder < ActionView::Helpers::FormBuilder
|
|
92
102
|
protected
|
93
103
|
|
94
104
|
# Main rendering method
|
95
|
-
def default_field(field_name, method, options =
|
105
|
+
def default_field(field_name, method, options = nil, &block)
|
106
|
+
options ||= {}
|
96
107
|
return yield if options.delete(:builder) == false && block_given?
|
97
108
|
builder_options = builder_options!(options)
|
98
109
|
@template.render(
|
data/test/dummy/README.rdoc
CHANGED
@@ -1,261 +1,28 @@
|
|
1
|
-
==
|
1
|
+
== README
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
5
|
|
6
|
-
|
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.
|
6
|
+
Things you may want to cover:
|
13
7
|
|
14
|
-
|
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.
|
8
|
+
* Ruby version
|
19
9
|
|
20
|
-
|
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.
|
10
|
+
* System dependencies
|
27
11
|
|
12
|
+
* Configuration
|
28
13
|
|
29
|
-
|
14
|
+
* Database creation
|
30
15
|
|
31
|
-
|
32
|
-
<tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
|
16
|
+
* Database initialization
|
33
17
|
|
34
|
-
|
35
|
-
<tt>cd myapp; rails server</tt> (run with --help for options)
|
18
|
+
* How to run the test suite
|
36
19
|
|
37
|
-
|
38
|
-
"Welcome aboard: You're riding Ruby on Rails!"
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
39
21
|
|
40
|
-
|
41
|
-
the following resources handy:
|
22
|
+
* Deployment instructions
|
42
23
|
|
43
|
-
*
|
44
|
-
* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
|
24
|
+
* ...
|
45
25
|
|
46
26
|
|
47
|
-
|
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.
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|