has_many_polymorphs 2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +86 -0
- data/LICENSE +184 -0
- data/Manifest +173 -0
- data/README +205 -0
- data/Rakefile +28 -0
- data/TODO +2 -0
- data/examples/hmph.rb +69 -0
- data/generators/tagging/tagging_generator.rb +97 -0
- data/generators/tagging/templates/migration.rb +28 -0
- data/generators/tagging/templates/tag.rb +39 -0
- data/generators/tagging/templates/tag_test.rb +15 -0
- data/generators/tagging/templates/tagging.rb +16 -0
- data/generators/tagging/templates/tagging_extensions.rb +203 -0
- data/generators/tagging/templates/tagging_test.rb +85 -0
- data/generators/tagging/templates/taggings.yml +23 -0
- data/generators/tagging/templates/tags.yml +7 -0
- data/has_many_polymorphs.gemspec +36 -0
- data/init.rb +2 -0
- data/lib/has_many_polymorphs/association.rb +160 -0
- data/lib/has_many_polymorphs/autoload.rb +69 -0
- data/lib/has_many_polymorphs/base.rb +60 -0
- data/lib/has_many_polymorphs/class_methods.rb +600 -0
- data/lib/has_many_polymorphs/configuration.rb +19 -0
- data/lib/has_many_polymorphs/debugging_tools.rb +103 -0
- data/lib/has_many_polymorphs/rake_task_redefine_task.rb +35 -0
- data/lib/has_many_polymorphs/reflection.rb +58 -0
- data/lib/has_many_polymorphs/support_methods.rb +88 -0
- data/lib/has_many_polymorphs.rb +27 -0
- data/test/fixtures/bow_wows.yml +10 -0
- data/test/fixtures/cats.yml +18 -0
- data/test/fixtures/eaters_foodstuffs.yml +0 -0
- data/test/fixtures/fish.yml +12 -0
- data/test/fixtures/frogs.yml +5 -0
- data/test/fixtures/keep_your_enemies_close.yml +0 -0
- data/test/fixtures/little_whale_pupils.yml +0 -0
- data/test/fixtures/people.yml +7 -0
- data/test/fixtures/petfoods.yml +11 -0
- data/test/fixtures/whales.yml +5 -0
- data/test/fixtures/wild_boars.yml +10 -0
- data/test/generator/tagging_generator_test.rb +42 -0
- data/test/integration/app/README +182 -0
- data/test/integration/app/Rakefile +19 -0
- data/test/integration/app/app/controllers/application.rb +7 -0
- data/test/integration/app/app/controllers/bones_controller.rb +5 -0
- data/test/integration/app/app/helpers/addresses_helper.rb +2 -0
- data/test/integration/app/app/helpers/application_helper.rb +3 -0
- data/test/integration/app/app/helpers/bones_helper.rb +2 -0
- data/test/integration/app/app/helpers/sellers_helper.rb +28 -0
- data/test/integration/app/app/helpers/states_helper.rb +2 -0
- data/test/integration/app/app/helpers/users_helper.rb +2 -0
- data/test/integration/app/app/models/bone.rb +2 -0
- data/test/integration/app/app/models/double_sti_parent.rb +2 -0
- data/test/integration/app/app/models/double_sti_parent_relationship.rb +2 -0
- data/test/integration/app/app/models/organic_substance.rb +2 -0
- data/test/integration/app/app/models/single_sti_parent.rb +4 -0
- data/test/integration/app/app/models/single_sti_parent_relationship.rb +4 -0
- data/test/integration/app/app/models/stick.rb +2 -0
- data/test/integration/app/app/models/stone.rb +2 -0
- data/test/integration/app/app/views/addresses/edit.html.erb +12 -0
- data/test/integration/app/app/views/addresses/index.html.erb +18 -0
- data/test/integration/app/app/views/addresses/new.html.erb +11 -0
- data/test/integration/app/app/views/addresses/show.html.erb +3 -0
- data/test/integration/app/app/views/bones/index.rhtml +5 -0
- data/test/integration/app/app/views/layouts/addresses.html.erb +17 -0
- data/test/integration/app/app/views/layouts/sellers.html.erb +17 -0
- data/test/integration/app/app/views/layouts/states.html.erb +17 -0
- data/test/integration/app/app/views/layouts/users.html.erb +17 -0
- data/test/integration/app/app/views/sellers/edit.html.erb +12 -0
- data/test/integration/app/app/views/sellers/index.html.erb +20 -0
- data/test/integration/app/app/views/sellers/new.html.erb +11 -0
- data/test/integration/app/app/views/sellers/show.html.erb +3 -0
- data/test/integration/app/app/views/states/edit.html.erb +12 -0
- data/test/integration/app/app/views/states/index.html.erb +19 -0
- data/test/integration/app/app/views/states/new.html.erb +11 -0
- data/test/integration/app/app/views/states/show.html.erb +3 -0
- data/test/integration/app/app/views/users/edit.html.erb +12 -0
- data/test/integration/app/app/views/users/index.html.erb +22 -0
- data/test/integration/app/app/views/users/new.html.erb +11 -0
- data/test/integration/app/app/views/users/show.html.erb +3 -0
- data/test/integration/app/config/boot.rb +110 -0
- data/test/integration/app/config/database.yml +17 -0
- data/test/integration/app/config/environment.rb +19 -0
- data/test/integration/app/config/environment.rb.canonical +19 -0
- data/test/integration/app/config/environments/development.rb +9 -0
- data/test/integration/app/config/environments/production.rb +18 -0
- data/test/integration/app/config/environments/test.rb +19 -0
- data/test/integration/app/config/locomotive.yml +6 -0
- data/test/integration/app/config/routes.rb +33 -0
- data/test/integration/app/config/ultrasphinx/default.base +56 -0
- data/test/integration/app/config/ultrasphinx/development.conf.canonical +155 -0
- data/test/integration/app/db/migrate/001_create_sticks.rb +11 -0
- data/test/integration/app/db/migrate/002_create_stones.rb +11 -0
- data/test/integration/app/db/migrate/003_create_organic_substances.rb +11 -0
- data/test/integration/app/db/migrate/004_create_bones.rb +8 -0
- data/test/integration/app/db/migrate/005_create_single_sti_parents.rb +11 -0
- data/test/integration/app/db/migrate/006_create_double_sti_parents.rb +11 -0
- data/test/integration/app/db/migrate/007_create_single_sti_parent_relationships.rb +13 -0
- data/test/integration/app/db/migrate/008_create_double_sti_parent_relationships.rb +14 -0
- data/test/integration/app/db/migrate/009_create_library_model.rb +11 -0
- data/test/integration/app/doc/README_FOR_APP +2 -0
- data/test/integration/app/generators/commenting_generator_test.rb +83 -0
- data/test/integration/app/lib/library_model.rb +2 -0
- data/test/integration/app/public/404.html +30 -0
- data/test/integration/app/public/500.html +30 -0
- data/test/integration/app/public/dispatch.cgi +10 -0
- data/test/integration/app/public/dispatch.fcgi +24 -0
- data/test/integration/app/public/dispatch.rb +10 -0
- data/test/integration/app/public/favicon.ico +0 -0
- data/test/integration/app/public/images/rails.png +0 -0
- data/test/integration/app/public/index.html +277 -0
- data/test/integration/app/public/javascripts/application.js +2 -0
- data/test/integration/app/public/javascripts/controls.js +833 -0
- data/test/integration/app/public/javascripts/dragdrop.js +942 -0
- data/test/integration/app/public/javascripts/effects.js +1088 -0
- data/test/integration/app/public/javascripts/prototype.js +2515 -0
- data/test/integration/app/public/robots.txt +1 -0
- data/test/integration/app/public/stylesheets/scaffold.css +74 -0
- data/test/integration/app/script/about +3 -0
- data/test/integration/app/script/breakpointer +3 -0
- data/test/integration/app/script/console +3 -0
- data/test/integration/app/script/destroy +3 -0
- data/test/integration/app/script/generate +3 -0
- data/test/integration/app/script/performance/benchmarker +3 -0
- data/test/integration/app/script/performance/profiler +3 -0
- data/test/integration/app/script/plugin +3 -0
- data/test/integration/app/script/process/inspector +3 -0
- data/test/integration/app/script/process/reaper +3 -0
- data/test/integration/app/script/process/spawner +3 -0
- data/test/integration/app/script/runner +3 -0
- data/test/integration/app/script/server +3 -0
- data/test/integration/app/test/fixtures/double_sti_parent_relationships.yml +7 -0
- data/test/integration/app/test/fixtures/double_sti_parents.yml +7 -0
- data/test/integration/app/test/fixtures/organic_substances.yml +5 -0
- data/test/integration/app/test/fixtures/single_sti_parent_relationships.yml +7 -0
- data/test/integration/app/test/fixtures/single_sti_parents.yml +7 -0
- data/test/integration/app/test/fixtures/sticks.yml +7 -0
- data/test/integration/app/test/fixtures/stones.yml +7 -0
- data/test/integration/app/test/functional/addresses_controller_test.rb +57 -0
- data/test/integration/app/test/functional/bones_controller_test.rb +8 -0
- data/test/integration/app/test/functional/sellers_controller_test.rb +57 -0
- data/test/integration/app/test/functional/states_controller_test.rb +57 -0
- data/test/integration/app/test/functional/users_controller_test.rb +57 -0
- data/test/integration/app/test/test_helper.rb +8 -0
- data/test/integration/app/test/unit/bone_test.rb +8 -0
- data/test/integration/app/test/unit/double_sti_parent_relationship_test.rb +8 -0
- data/test/integration/app/test/unit/double_sti_parent_test.rb +8 -0
- data/test/integration/app/test/unit/organic_substance_test.rb +8 -0
- data/test/integration/app/test/unit/single_sti_parent_relationship_test.rb +8 -0
- data/test/integration/app/test/unit/single_sti_parent_test.rb +8 -0
- data/test/integration/app/test/unit/stick_test.rb +8 -0
- data/test/integration/app/test/unit/stone_test.rb +8 -0
- data/test/integration/server_test.rb +43 -0
- data/test/models/aquatic/fish.rb +5 -0
- data/test/models/aquatic/pupils_whale.rb +7 -0
- data/test/models/aquatic/whale.rb +15 -0
- data/test/models/beautiful_fight_relationship.rb +26 -0
- data/test/models/canine.rb +9 -0
- data/test/models/cat.rb +5 -0
- data/test/models/dog.rb +18 -0
- data/test/models/eaters_foodstuff.rb +8 -0
- data/test/models/frog.rb +4 -0
- data/test/models/kitten.rb +3 -0
- data/test/models/parentship.rb +4 -0
- data/test/models/person.rb +9 -0
- data/test/models/petfood.rb +39 -0
- data/test/models/tabby.rb +2 -0
- data/test/models/wild_boar.rb +3 -0
- data/test/modules/extension_module.rb +9 -0
- data/test/modules/other_extension_module.rb +9 -0
- data/test/patches/symlinked_plugins_1.2.6.diff +46 -0
- data/test/schema.rb +87 -0
- data/test/setup.rb +14 -0
- data/test/test_helper.rb +52 -0
- data/test/unit/has_many_polymorphs_test.rb +713 -0
- data.tar.gz.sig +1 -0
- metadata +279 -0
- metadata.gz.sig +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module SellersHelper
|
|
2
|
+
|
|
3
|
+
def display_address(seller)
|
|
4
|
+
logger.info "Seller Data ===================="
|
|
5
|
+
logger.info seller.inspect
|
|
6
|
+
logger.info "Seller responds to address " + seller.respond_to?("address").to_s
|
|
7
|
+
logger.info "Seller responds to address= " + seller.respond_to?("address=").to_s
|
|
8
|
+
# logger.info seller.methods.sort.inspect
|
|
9
|
+
logger.info "User Data ===================="
|
|
10
|
+
logger.info seller.user.inspect
|
|
11
|
+
logger.info "User responds to address " + seller.user.respond_to?("address").to_s
|
|
12
|
+
logger.info "User responds to address= " + seller.user.respond_to?("address=").to_s
|
|
13
|
+
# logger.info seller.user.methods.sort.inspect
|
|
14
|
+
display_address = Array.new
|
|
15
|
+
if seller.address
|
|
16
|
+
display_address << seller.address.city if seller.address.city
|
|
17
|
+
display_address << seller.address.state.abbreviation if seller.address.state && seller.address.state.abbreviation
|
|
18
|
+
display_address << seller.address.zip_postal_code if seller.address.zip_postal_code
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
unless display_address.empty?
|
|
22
|
+
"Location: " + display_address.join(", ")
|
|
23
|
+
else
|
|
24
|
+
"Location: unknown"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<h1>Listing addresses</h1>
|
|
2
|
+
|
|
3
|
+
<table>
|
|
4
|
+
<tr>
|
|
5
|
+
</tr>
|
|
6
|
+
|
|
7
|
+
<% for address in @addresses %>
|
|
8
|
+
<tr>
|
|
9
|
+
<td><%= link_to 'Show', address %></td>
|
|
10
|
+
<td><%= link_to 'Edit', edit_address_path(address) %></td>
|
|
11
|
+
<td><%= link_to 'Destroy', address, :confirm => 'Are you sure?', :method => :delete %></td>
|
|
12
|
+
</tr>
|
|
13
|
+
<% end %>
|
|
14
|
+
</table>
|
|
15
|
+
|
|
16
|
+
<br />
|
|
17
|
+
|
|
18
|
+
<%= link_to 'New address', new_address_path %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
|
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
+
<head>
|
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
|
7
|
+
<title>Addresses: <%= controller.action_name %></title>
|
|
8
|
+
<%= stylesheet_link_tag 'scaffold' %>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<p style="color: green"><%= flash[:notice] %></p>
|
|
13
|
+
|
|
14
|
+
<%= yield %>
|
|
15
|
+
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
|
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
+
<head>
|
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
|
7
|
+
<title>Sellers: <%= controller.action_name %></title>
|
|
8
|
+
<%= stylesheet_link_tag 'scaffold' %>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<p style="color: green"><%= flash[:notice] %></p>
|
|
13
|
+
|
|
14
|
+
<%= yield %>
|
|
15
|
+
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
|
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
+
<head>
|
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
|
7
|
+
<title>States: <%= controller.action_name %></title>
|
|
8
|
+
<%= stylesheet_link_tag 'scaffold' %>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<p style="color: green"><%= flash[:notice] %></p>
|
|
13
|
+
|
|
14
|
+
<%= yield %>
|
|
15
|
+
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
|
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
+
<head>
|
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
|
7
|
+
<title>Users: <%= controller.action_name %></title>
|
|
8
|
+
<%= stylesheet_link_tag 'scaffold' %>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<p style="color: green"><%= flash[:notice] %></p>
|
|
13
|
+
|
|
14
|
+
<%= yield %>
|
|
15
|
+
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<h1>Listing sellers</h1>
|
|
2
|
+
|
|
3
|
+
<table>
|
|
4
|
+
<tr>
|
|
5
|
+
</tr>
|
|
6
|
+
|
|
7
|
+
<% for seller in @sellers %>
|
|
8
|
+
<tr>
|
|
9
|
+
<td><%= h(seller.company_name) %></td>
|
|
10
|
+
<td><%= h(display_address(seller)) %></td>
|
|
11
|
+
<td><%= link_to 'Show', seller %></td>
|
|
12
|
+
<td><%= link_to 'Edit', edit_seller_path(seller) %></td>
|
|
13
|
+
<td><%= link_to 'Destroy', seller, :confirm => 'Are you sure?', :method => :delete %></td>
|
|
14
|
+
</tr>
|
|
15
|
+
<% end %>
|
|
16
|
+
</table>
|
|
17
|
+
|
|
18
|
+
<br />
|
|
19
|
+
|
|
20
|
+
<%= link_to 'New seller', new_seller_path %>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<h1>Listing states</h1>
|
|
2
|
+
|
|
3
|
+
<table>
|
|
4
|
+
<tr>
|
|
5
|
+
</tr>
|
|
6
|
+
|
|
7
|
+
<% for state in @states %>
|
|
8
|
+
<tr>
|
|
9
|
+
<td><%= state.name %></td>
|
|
10
|
+
<td><%= link_to 'Show', state %></td>
|
|
11
|
+
<td><%= link_to 'Edit', edit_state_path(state) %></td>
|
|
12
|
+
<td><%= link_to 'Destroy', state, :confirm => 'Are you sure?', :method => :delete %></td>
|
|
13
|
+
</tr>
|
|
14
|
+
<% end %>
|
|
15
|
+
</table>
|
|
16
|
+
|
|
17
|
+
<br />
|
|
18
|
+
|
|
19
|
+
<%= link_to 'New state', new_state_path %>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<h1>Listing users</h1>
|
|
2
|
+
|
|
3
|
+
<table>
|
|
4
|
+
<tr>
|
|
5
|
+
</tr>
|
|
6
|
+
|
|
7
|
+
<% for user in @users %>
|
|
8
|
+
<tr>
|
|
9
|
+
<td><%= h(user.login) %></td>
|
|
10
|
+
<td><%= h(user.address.line_1) %></td>
|
|
11
|
+
<td><%= h(user.address.city) %></td>
|
|
12
|
+
<td><%= h(user.address.state.name) %></td>
|
|
13
|
+
<td><%= link_to 'Show', user %></td>
|
|
14
|
+
<td><%= link_to 'Edit', edit_user_path(user) %></td>
|
|
15
|
+
<td><%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %></td>
|
|
16
|
+
</tr>
|
|
17
|
+
<% end %>
|
|
18
|
+
</table>
|
|
19
|
+
|
|
20
|
+
<br />
|
|
21
|
+
|
|
22
|
+
<%= link_to 'New user', new_user_path %>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Don't change this file!
|
|
2
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
|
3
|
+
|
|
4
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
|
5
|
+
|
|
6
|
+
module Rails
|
|
7
|
+
class << self
|
|
8
|
+
def boot!
|
|
9
|
+
unless booted?
|
|
10
|
+
preinitialize
|
|
11
|
+
pick_boot.run
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def booted?
|
|
16
|
+
defined? Rails::Initializer
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def pick_boot
|
|
20
|
+
(vendor_rails? ? VendorBoot : GemBoot).new
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def vendor_rails?
|
|
24
|
+
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def preinitialize
|
|
28
|
+
load(preinitializer_path) if File.exists?(preinitializer_path)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def preinitializer_path
|
|
32
|
+
"#{RAILS_ROOT}/config/preinitializer.rb"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class Boot
|
|
37
|
+
def run
|
|
38
|
+
load_initializer
|
|
39
|
+
Rails::Initializer.run(:set_load_path)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class VendorBoot < Boot
|
|
44
|
+
def load_initializer
|
|
45
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class GemBoot < Boot
|
|
50
|
+
def load_initializer
|
|
51
|
+
self.class.load_rubygems
|
|
52
|
+
load_rails_gem
|
|
53
|
+
require 'initializer'
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def load_rails_gem
|
|
57
|
+
if version = self.class.gem_version
|
|
58
|
+
STDERR.puts "Boot.rb loading version #{version}"
|
|
59
|
+
gem 'rails', version
|
|
60
|
+
else
|
|
61
|
+
STDERR.puts "Boot.rb loading latest available version"
|
|
62
|
+
gem 'rails'
|
|
63
|
+
end
|
|
64
|
+
rescue Gem::LoadError => load_error
|
|
65
|
+
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
|
66
|
+
exit 1
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
class << self
|
|
70
|
+
def rubygems_version
|
|
71
|
+
Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def gem_version
|
|
75
|
+
if defined? RAILS_GEM_VERSION
|
|
76
|
+
RAILS_GEM_VERSION
|
|
77
|
+
elsif ENV.include?('RAILS_GEM_VERSION')
|
|
78
|
+
ENV['RAILS_GEM_VERSION']
|
|
79
|
+
else
|
|
80
|
+
parse_gem_version(read_environment_rb)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def load_rubygems
|
|
85
|
+
require 'rubygems'
|
|
86
|
+
|
|
87
|
+
unless rubygems_version >= '0.9.4'
|
|
88
|
+
$stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
|
89
|
+
exit 1
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
rescue LoadError
|
|
93
|
+
$stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
|
94
|
+
exit 1
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def parse_gem_version(text)
|
|
98
|
+
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*'([!~<>=]*\s*[\d.]+)'/
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
private
|
|
102
|
+
def read_environment_rb
|
|
103
|
+
File.read("#{RAILS_ROOT}/config/environment.rb")
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# All that for this:
|
|
110
|
+
Rails.boot!
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
|
2
|
+
require 'action_controller'
|
|
3
|
+
|
|
4
|
+
Rails::Initializer.run do |config|
|
|
5
|
+
|
|
6
|
+
if ActionController::Base.respond_to? 'session='
|
|
7
|
+
config.action_controller.session = {:session_key => '_app_session', :secret => '22cde4d5c1a61ba69a81795322cde4d5c1a61ba69a817953'}
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
config.load_paths << "#{RAILS_ROOT}/app/models/person" # moduleless model path
|
|
11
|
+
|
|
12
|
+
config.after_initialize do
|
|
13
|
+
config.has_many_polymorphs_options['requirements'] << "#{RAILS_ROOT}/lib/library_model"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Dependencies.log_activity = true
|
|
18
|
+
|
|
19
|
+
ENV['RAILS_ASSET_ID'] = Time.now.to_i.to_s
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
|
2
|
+
require 'action_controller'
|
|
3
|
+
|
|
4
|
+
Rails::Initializer.run do |config|
|
|
5
|
+
|
|
6
|
+
if ActionController::Base.respond_to? 'session='
|
|
7
|
+
config.action_controller.session = {:session_key => '_app_session', :secret => '22cde4d5c1a61ba69a81795322cde4d5c1a61ba69a817953'}
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
config.load_paths << "#{RAILS_ROOT}/app/models/person" # moduleless model path
|
|
11
|
+
|
|
12
|
+
config.after_initialize do
|
|
13
|
+
config.has_many_polymorphs_options['requirements'] << "#{RAILS_ROOT}/lib/library_model"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Dependencies.log_activity = true
|
|
18
|
+
|
|
19
|
+
ENV['RAILS_ASSET_ID'] = Time.now.to_i.to_s
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
config.cache_classes = ENV['PRODUCTION']
|
|
3
|
+
config.whiny_nils = true
|
|
4
|
+
config.action_controller.consider_all_requests_local = !ENV['PRODUCTION']
|
|
5
|
+
config.action_controller.perform_caching = ENV['PRODUCTION']
|
|
6
|
+
# The following has been deprecated in Rails 2.1 and removed in 2.2
|
|
7
|
+
config.action_view.cache_template_extensions = ENV['PRODUCTION'] if Rails::VERSION::MAJOR < 2 or Rails::VERSION::MAJOR == 2 && Rails::VERSION::MINOR < 1
|
|
8
|
+
config.action_view.debug_rjs = !ENV['PRODUCTION']
|
|
9
|
+
config.action_mailer.raise_delivery_errors = false
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
|
2
|
+
|
|
3
|
+
# The production environment is meant for finished, "live" apps.
|
|
4
|
+
# Code is not reloaded between requests
|
|
5
|
+
config.cache_classes = true
|
|
6
|
+
|
|
7
|
+
# Use a different logger for distributed setups
|
|
8
|
+
# config.logger = SyslogLogger.new
|
|
9
|
+
|
|
10
|
+
# Full error reports are disabled and caching is turned on
|
|
11
|
+
config.action_controller.consider_all_requests_local = false
|
|
12
|
+
config.action_controller.perform_caching = true
|
|
13
|
+
|
|
14
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
|
15
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
|
16
|
+
|
|
17
|
+
# Disable delivery errors, bad email addresses will be ignored
|
|
18
|
+
# config.action_mailer.raise_delivery_errors = false
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
|
2
|
+
|
|
3
|
+
# The test environment is used exclusively to run your application's
|
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
|
7
|
+
config.cache_classes = true
|
|
8
|
+
|
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
|
10
|
+
config.whiny_nils = true
|
|
11
|
+
|
|
12
|
+
# Show full error reports and disable caching
|
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
|
14
|
+
config.action_controller.perform_caching = false
|
|
15
|
+
|
|
16
|
+
# Tell ActionMailer not to deliver emails to the real world.
|
|
17
|
+
# The :test delivery method accumulates sent emails in the
|
|
18
|
+
# ActionMailer::Base.deliveries array.
|
|
19
|
+
config.action_mailer.delivery_method = :test
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
|
2
|
+
map.resources :states
|
|
3
|
+
|
|
4
|
+
map.resources :states
|
|
5
|
+
|
|
6
|
+
map.resources :addresses
|
|
7
|
+
|
|
8
|
+
map.resources :sellers
|
|
9
|
+
|
|
10
|
+
map.resources :users
|
|
11
|
+
|
|
12
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
|
13
|
+
|
|
14
|
+
# Sample of regular route:
|
|
15
|
+
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
|
16
|
+
# Keep in mind you can assign values other than :controller and :action
|
|
17
|
+
|
|
18
|
+
# Sample of named route:
|
|
19
|
+
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
|
20
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
|
21
|
+
|
|
22
|
+
# You can have the root of your site routed by hooking up ''
|
|
23
|
+
# -- just remember to delete public/index.html.
|
|
24
|
+
# map.connect '', :controller => "welcome"
|
|
25
|
+
|
|
26
|
+
# Allow downloading Web Service WSDL as a file with an extension
|
|
27
|
+
# instead of a file named 'wsdl'
|
|
28
|
+
map.connect ':controller/service.wsdl', :action => 'wsdl'
|
|
29
|
+
|
|
30
|
+
# Install the default route as the lowest priority.
|
|
31
|
+
map.connect ':controller/:action/:id.:format'
|
|
32
|
+
map.connect ':controller/:action/:id'
|
|
33
|
+
end
|