hydra-editor 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/README.md +1 -1
- data/app/views/records/new.html.erb +1 -1
- data/lib/hydra_editor/version.rb +1 -1
- metadata +25 -225
- data/spec/dummy/Gemfile +0 -20
- data/spec/dummy/Gemfile.lock +0 -247
- data/spec/dummy/README.rdoc +0 -261
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/assets/images/blacklight/bg.png +0 -0
- data/spec/dummy/app/assets/images/blacklight/border.png +0 -0
- data/spec/dummy/app/assets/images/blacklight/bul_sq_gry.gif +0 -0
- data/spec/dummy/app/assets/images/blacklight/checkmark.gif +0 -0
- data/spec/dummy/app/assets/images/blacklight/logo.png +0 -0
- data/spec/dummy/app/assets/images/blacklight/magnifying_glass.gif +0 -0
- data/spec/dummy/app/assets/images/blacklight/remove.gif +0 -0
- data/spec/dummy/app/assets/images/blacklight/separator.gif +0 -0
- data/spec/dummy/app/assets/images/blacklight/start_over.gif +0 -0
- data/spec/dummy/app/assets/images/rails.png +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +0 -18
- data/spec/dummy/app/assets/stylesheets/application.css +0 -13
- data/spec/dummy/app/assets/stylesheets/blacklight.css.scss +0 -4
- data/spec/dummy/app/controllers/application_controller.rb +0 -10
- data/spec/dummy/app/controllers/catalog_controller.rb +0 -165
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/models/solr_document.rb +0 -33
- data/spec/dummy/app/models/user.rb +0 -22
- data/spec/dummy/app/views/devise/confirmations/new.html.erb +0 -12
- data/spec/dummy/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
- data/spec/dummy/app/views/devise/mailer/reset_password_instructions.html.erb +0 -8
- data/spec/dummy/app/views/devise/mailer/unlock_instructions.html.erb +0 -7
- data/spec/dummy/app/views/devise/passwords/edit.html.erb +0 -16
- data/spec/dummy/app/views/devise/passwords/new.html.erb +0 -12
- data/spec/dummy/app/views/devise/registrations/edit.html.erb +0 -29
- data/spec/dummy/app/views/devise/registrations/new.html.erb +0 -18
- data/spec/dummy/app/views/devise/sessions/new.html.erb +0 -17
- data/spec/dummy/app/views/devise/shared/_links.erb +0 -25
- data/spec/dummy/app/views/devise/unlocks/new.html.erb +0 -12
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/SolrMarc/config-test.properties +0 -37
- data/spec/dummy/config/SolrMarc/config.properties +0 -37
- data/spec/dummy/config/SolrMarc/index.properties +0 -97
- data/spec/dummy/config/SolrMarc/index_scripts/dewey.bsh +0 -47
- data/spec/dummy/config/SolrMarc/index_scripts/format.bsh +0 -126
- data/spec/dummy/config/SolrMarc/translation_maps/README_MAPS +0 -1
- data/spec/dummy/config/SolrMarc/translation_maps/callnumber_map.properties +0 -407
- data/spec/dummy/config/SolrMarc/translation_maps/composition_era_map.properties +0 -56
- data/spec/dummy/config/SolrMarc/translation_maps/country_map.properties +0 -379
- data/spec/dummy/config/SolrMarc/translation_maps/format_map.properties +0 -50
- data/spec/dummy/config/SolrMarc/translation_maps/instrument_map.properties +0 -101
- data/spec/dummy/config/SolrMarc/translation_maps/language_map.properties +0 -490
- data/spec/dummy/config/application.rb +0 -72
- data/spec/dummy/config/boot.rb +0 -6
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -37
- data/spec/dummy/config/environments/production.rb +0 -67
- data/spec/dummy/config/environments/test.rb +0 -37
- data/spec/dummy/config/fedora.yml +0 -14
- data/spec/dummy/config/initializers/action_dispatch_http_upload_monkey_patch.rb +0 -12
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/devise.rb +0 -246
- data/spec/dummy/config/initializers/hydra_config.rb +0 -28
- data/spec/dummy/config/initializers/inflections.rb +0 -15
- data/spec/dummy/config/initializers/mime_types.rb +0 -12
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/jetty.yml +0 -5
- data/spec/dummy/config/locales/devise.en.yml +0 -59
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/role_map_cucumber.yml +0 -10
- data/spec/dummy/config/role_map_development.yml +0 -12
- data/spec/dummy/config/role_map_production.yml +0 -2
- data/spec/dummy/config/role_map_test.yml +0 -15
- data/spec/dummy/config/routes.rb +0 -66
- data/spec/dummy/config/solr.yml +0 -10
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20130618142846_devise_create_users.rb +0 -46
- data/spec/dummy/db/migrate/20130618142855_create_searches.rb +0 -16
- data/spec/dummy/db/migrate/20130618142856_create_bookmarks.rb +0 -18
- data/spec/dummy/db/migrate/20130618142857_remove_editable_fields_from_bookmarks.rb +0 -12
- data/spec/dummy/db/migrate/20130618142858_add_user_types_to_bookmarks_searches.rb +0 -16
- data/spec/dummy/db/schema.rb +0 -53
- data/spec/dummy/db/seeds.rb +0 -7
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/doc/README_FOR_APP +0 -2
- data/spec/dummy/fedora_conf/conf/development/fedora.fcfg +0 -953
- data/spec/dummy/fedora_conf/conf/test/fedora.fcfg +0 -953
- data/spec/dummy/lib/generators/test_app_generator.rb +0 -26
- data/spec/dummy/log/development.log +0 -78
- data/spec/dummy/log/test.log +0 -119
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -25
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/index.html +0 -241
- data/spec/dummy/public/robots.txt +0 -5
- data/spec/dummy/script/rails +0 -6
- data/spec/dummy/solr_conf/conf/schema.xml +0 -273
- data/spec/dummy/solr_conf/conf/solrconfig.xml +0 -167
- data/spec/dummy/solr_conf/solr.xml +0 -35
- data/spec/dummy/test/performance/browsing_test.rb +0 -12
- data/spec/dummy/test/test_helper.rb +0 -13
data/spec/dummy/Gemfile.lock
DELETED
@@ -1,247 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ../../
|
3
|
-
specs:
|
4
|
-
hydra-editor (0.0.2)
|
5
|
-
active-fedora (>= 6.3.0)
|
6
|
-
bootstrap_forms
|
7
|
-
rails (~> 3.2.13)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
actionmailer (3.2.13)
|
13
|
-
actionpack (= 3.2.13)
|
14
|
-
mail (~> 2.5.3)
|
15
|
-
actionpack (3.2.13)
|
16
|
-
activemodel (= 3.2.13)
|
17
|
-
activesupport (= 3.2.13)
|
18
|
-
builder (~> 3.0.0)
|
19
|
-
erubis (~> 2.7.0)
|
20
|
-
journey (~> 1.0.4)
|
21
|
-
rack (~> 1.4.5)
|
22
|
-
rack-cache (~> 1.2)
|
23
|
-
rack-test (~> 0.6.1)
|
24
|
-
sprockets (~> 2.2.1)
|
25
|
-
active-fedora (6.3.0)
|
26
|
-
activesupport (>= 3.0.0)
|
27
|
-
deprecation
|
28
|
-
mediashelf-loggable
|
29
|
-
nom-xml (>= 0.5.1)
|
30
|
-
om (~> 2.1.0)
|
31
|
-
rdf
|
32
|
-
rdf-rdfxml (~> 1.0.0)
|
33
|
-
rsolr
|
34
|
-
rubydora (~> 1.6, >= 1.6.5)
|
35
|
-
activemodel (3.2.13)
|
36
|
-
activesupport (= 3.2.13)
|
37
|
-
builder (~> 3.0.0)
|
38
|
-
activerecord (3.2.13)
|
39
|
-
activemodel (= 3.2.13)
|
40
|
-
activesupport (= 3.2.13)
|
41
|
-
arel (~> 3.0.2)
|
42
|
-
tzinfo (~> 0.3.29)
|
43
|
-
activeresource (3.2.13)
|
44
|
-
activemodel (= 3.2.13)
|
45
|
-
activesupport (= 3.2.13)
|
46
|
-
activesupport (3.2.13)
|
47
|
-
i18n (= 0.6.1)
|
48
|
-
multi_json (~> 1.0)
|
49
|
-
addressable (2.3.4)
|
50
|
-
arel (3.0.2)
|
51
|
-
bcrypt-ruby (3.0.1)
|
52
|
-
blacklight (4.2.1)
|
53
|
-
bootstrap-sass (>= 2.2.0, < 2.4)
|
54
|
-
kaminari (~> 0.13)
|
55
|
-
marc (>= 0.4.3, < 1.1)
|
56
|
-
nokogiri (~> 1.5)
|
57
|
-
rails (>= 3.2)
|
58
|
-
rsolr (~> 1.0.6)
|
59
|
-
sass-rails
|
60
|
-
block_helpers (0.3.3)
|
61
|
-
activesupport (>= 2.0)
|
62
|
-
bootstrap-sass (2.3.2.0)
|
63
|
-
sass (~> 3.2)
|
64
|
-
bootstrap_forms (3.0.1)
|
65
|
-
builder (3.0.4)
|
66
|
-
cancan (1.6.10)
|
67
|
-
childprocess (0.3.9)
|
68
|
-
ffi (~> 1.0, >= 1.0.11)
|
69
|
-
daemons (1.1.9)
|
70
|
-
deprecation (0.0.5)
|
71
|
-
activesupport
|
72
|
-
devise (2.2.4)
|
73
|
-
bcrypt-ruby (~> 3.0)
|
74
|
-
orm_adapter (~> 0.1)
|
75
|
-
railties (~> 3.1)
|
76
|
-
warden (~> 1.2.1)
|
77
|
-
devise-guests (0.3.1)
|
78
|
-
devise
|
79
|
-
diff-lcs (1.2.4)
|
80
|
-
equivalent-xml (0.3.0)
|
81
|
-
nokogiri (>= 1.4.3)
|
82
|
-
erubis (2.7.0)
|
83
|
-
factory_girl (4.2.0)
|
84
|
-
activesupport (>= 3.0.0)
|
85
|
-
factory_girl_rails (4.2.1)
|
86
|
-
factory_girl (~> 4.2.0)
|
87
|
-
railties (>= 3.0.0)
|
88
|
-
fastercsv (1.5.5)
|
89
|
-
ffi (1.9.0)
|
90
|
-
hike (1.2.3)
|
91
|
-
hooks (0.3.1)
|
92
|
-
hydra-access-controls (6.2.2)
|
93
|
-
active-fedora (~> 6.1)
|
94
|
-
activesupport
|
95
|
-
blacklight
|
96
|
-
cancan
|
97
|
-
deprecation
|
98
|
-
hydra-core (6.2.2)
|
99
|
-
active-fedora
|
100
|
-
blacklight (~> 4.0)
|
101
|
-
block_helpers
|
102
|
-
deprecation (>= 0.0.5)
|
103
|
-
hydra-access-controls (= 6.2.2)
|
104
|
-
jettywrapper (>= 1.4.1)
|
105
|
-
rails (~> 3.2.3)
|
106
|
-
hydra-head (6.2.2)
|
107
|
-
hydra-access-controls (= 6.2.2)
|
108
|
-
hydra-core (= 6.2.2)
|
109
|
-
rails (>= 3.2.6)
|
110
|
-
i18n (0.6.1)
|
111
|
-
jettywrapper (1.4.1)
|
112
|
-
activesupport (>= 3.0.0)
|
113
|
-
childprocess
|
114
|
-
i18n
|
115
|
-
logger
|
116
|
-
mediashelf-loggable
|
117
|
-
journey (1.0.4)
|
118
|
-
json (1.8.0)
|
119
|
-
kaminari (0.14.1)
|
120
|
-
actionpack (>= 3.0.0)
|
121
|
-
activesupport (>= 3.0.0)
|
122
|
-
logger (1.2.8)
|
123
|
-
mail (2.5.4)
|
124
|
-
mime-types (~> 1.16)
|
125
|
-
treetop (~> 1.4.8)
|
126
|
-
marc (0.5.0)
|
127
|
-
mediashelf-loggable (0.4.9)
|
128
|
-
mime-types (1.23)
|
129
|
-
mini_portile (0.5.0)
|
130
|
-
multi_json (1.7.7)
|
131
|
-
nokogiri (1.6.0)
|
132
|
-
mini_portile (~> 0.5.0)
|
133
|
-
nom-xml (0.5.1)
|
134
|
-
activesupport
|
135
|
-
i18n
|
136
|
-
nokogiri
|
137
|
-
om (2.1.2)
|
138
|
-
activemodel
|
139
|
-
activesupport
|
140
|
-
deprecation
|
141
|
-
mediashelf-loggable
|
142
|
-
nokogiri (>= 1.4.2)
|
143
|
-
solrizer (~> 3.1.0)
|
144
|
-
orm_adapter (0.4.0)
|
145
|
-
polyglot (0.3.3)
|
146
|
-
rack (1.4.5)
|
147
|
-
rack-cache (1.2)
|
148
|
-
rack (>= 0.4)
|
149
|
-
rack-ssl (1.3.3)
|
150
|
-
rack
|
151
|
-
rack-test (0.6.2)
|
152
|
-
rack (>= 1.0)
|
153
|
-
rails (3.2.13)
|
154
|
-
actionmailer (= 3.2.13)
|
155
|
-
actionpack (= 3.2.13)
|
156
|
-
activerecord (= 3.2.13)
|
157
|
-
activeresource (= 3.2.13)
|
158
|
-
activesupport (= 3.2.13)
|
159
|
-
bundler (~> 1.0)
|
160
|
-
railties (= 3.2.13)
|
161
|
-
railties (3.2.13)
|
162
|
-
actionpack (= 3.2.13)
|
163
|
-
activesupport (= 3.2.13)
|
164
|
-
rack-ssl (~> 1.3.2)
|
165
|
-
rake (>= 0.8.7)
|
166
|
-
rdoc (~> 3.4)
|
167
|
-
thor (>= 0.14.6, < 2.0)
|
168
|
-
rake (10.0.4)
|
169
|
-
rdf (1.0.7)
|
170
|
-
addressable (>= 2.2)
|
171
|
-
rdf-rdfxml (1.0.1)
|
172
|
-
rdf (>= 1.0)
|
173
|
-
rdf-xsd (>= 1.0)
|
174
|
-
rdf-xsd (1.0.2.1)
|
175
|
-
nokogiri (>= 1.5.0)
|
176
|
-
rdf (>= 0.3.4)
|
177
|
-
rdoc (3.12.2)
|
178
|
-
json (~> 1.4)
|
179
|
-
rest-client (1.6.7)
|
180
|
-
mime-types (>= 1.16)
|
181
|
-
rsolr (1.0.9)
|
182
|
-
builder (>= 2.1.2)
|
183
|
-
rspec-core (2.13.1)
|
184
|
-
rspec-expectations (2.13.0)
|
185
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
186
|
-
rspec-mocks (2.13.1)
|
187
|
-
rspec-rails (2.13.2)
|
188
|
-
actionpack (>= 3.0)
|
189
|
-
activesupport (>= 3.0)
|
190
|
-
railties (>= 3.0)
|
191
|
-
rspec-core (~> 2.13.0)
|
192
|
-
rspec-expectations (~> 2.13.0)
|
193
|
-
rspec-mocks (~> 2.13.0)
|
194
|
-
rubydora (1.6.5)
|
195
|
-
activemodel
|
196
|
-
activesupport
|
197
|
-
deprecation
|
198
|
-
equivalent-xml
|
199
|
-
fastercsv
|
200
|
-
hooks (~> 0.3.0)
|
201
|
-
mime-types
|
202
|
-
nokogiri
|
203
|
-
rest-client
|
204
|
-
sass (3.2.9)
|
205
|
-
sass-rails (3.2.6)
|
206
|
-
railties (~> 3.2.0)
|
207
|
-
sass (>= 3.1.10)
|
208
|
-
tilt (~> 1.3)
|
209
|
-
solrizer (3.1.0)
|
210
|
-
activesupport
|
211
|
-
daemons
|
212
|
-
mediashelf-loggable (~> 0.4.7)
|
213
|
-
nokogiri
|
214
|
-
stomp
|
215
|
-
xml-simple
|
216
|
-
sprockets (2.2.2)
|
217
|
-
hike (~> 1.2)
|
218
|
-
multi_json (~> 1.0)
|
219
|
-
rack (~> 1.0)
|
220
|
-
tilt (~> 1.1, != 1.3.0)
|
221
|
-
sqlite3 (1.3.7)
|
222
|
-
stomp (1.2.9)
|
223
|
-
thor (0.18.1)
|
224
|
-
tilt (1.4.1)
|
225
|
-
treetop (1.4.14)
|
226
|
-
polyglot
|
227
|
-
polyglot (>= 0.3.1)
|
228
|
-
tzinfo (0.3.37)
|
229
|
-
warden (1.2.1)
|
230
|
-
rack (>= 1.0)
|
231
|
-
xml-simple (1.1.2)
|
232
|
-
|
233
|
-
PLATFORMS
|
234
|
-
ruby
|
235
|
-
|
236
|
-
DEPENDENCIES
|
237
|
-
blacklight
|
238
|
-
bootstrap-sass
|
239
|
-
devise
|
240
|
-
devise-guests (~> 0.3)
|
241
|
-
factory_girl_rails
|
242
|
-
hydra-editor!
|
243
|
-
hydra-head
|
244
|
-
jettywrapper
|
245
|
-
rails (= 3.2.13)
|
246
|
-
rspec-rails
|
247
|
-
sqlite3
|
data/spec/dummy/README.rdoc
DELETED
@@ -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
|
-
| |-- assets
|
177
|
-
| `-- tasks
|
178
|
-
|-- log
|
179
|
-
|-- public
|
180
|
-
|-- script
|
181
|
-
|-- test
|
182
|
-
| |-- fixtures
|
183
|
-
| |-- functional
|
184
|
-
| |-- integration
|
185
|
-
| |-- performance
|
186
|
-
| `-- unit
|
187
|
-
|-- tmp
|
188
|
-
| `-- cache
|
189
|
-
| `-- assets
|
190
|
-
`-- vendor
|
191
|
-
|-- assets
|
192
|
-
| |-- javascripts
|
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.
|