has_many_polymorphs 2.10 → 2.11
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +2 -0
- data/Manifest +191 -56
- data/TODO +1 -0
- data/examples/hmph.rb +69 -0
- data/generators/commenting/commenting_generator.rb +94 -0
- data/generators/commenting/templates/comment.rb +33 -0
- data/generators/commenting/templates/comment_test.rb +12 -0
- data/generators/commenting/templates/commenting.rb +13 -0
- data/generators/commenting/templates/commenting_extensions.rb +30 -0
- data/generators/commenting/templates/commenting_test.rb +30 -0
- data/generators/commenting/templates/commentings.yml +23 -0
- data/generators/commenting/templates/comments.yml +13 -0
- data/generators/commenting/templates/migration.rb +28 -0
- data/generators/tagging/templates/tagging_extensions.rb +4 -8
- data/has_many_polymorphs.gemspec +19 -12
- data/lib/has_many_polymorphs.rb +3 -4
- data/lib/has_many_polymorphs/autoload.rb +4 -4
- data/lib/has_many_polymorphs/class_methods.rb +8 -8
- data/lib/has_many_polymorphs/debugging_tools.rb +2 -0
- data/lib/has_many_polymorphs/dependencies.rb +9 -4
- data/lib/has_many_polymorphs/support_methods.rb +3 -1
- data/test/fixtures/{aquatic/fish.yml → fish.yml} +0 -0
- data/test/fixtures/{aquatic/little_whale_pupils.yml → little_whale_pupils.yml} +0 -0
- data/test/fixtures/{aquatic/whales.yml → whales.yml} +0 -0
- data/test/integration/app/README +182 -0
- data/test/integration/app/Rakefile +19 -0
- data/test/integration/app/app/controllers/addresses_controller.rb +85 -0
- data/test/integration/app/app/controllers/application.rb +7 -0
- data/test/integration/app/app/controllers/sellers_controller.rb +85 -0
- data/test/integration/app/app/controllers/states_controller.rb +85 -0
- data/test/integration/app/app/controllers/users_controller.rb +85 -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/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/address.rb +4 -0
- data/test/integration/app/app/models/citation.rb +3 -0
- data/test/integration/app/app/models/citations_item.rb +4 -0
- data/test/integration/app/app/models/seller.rb +4 -0
- data/test/integration/app/app/models/state.rb +3 -0
- data/test/integration/app/app/models/user.rb +4 -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/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 +45 -0
- data/test/integration/app/config/database.yml +21 -0
- data/test/integration/app/config/environment.rb +13 -0
- data/test/integration/app/config/environments/development.rb +7 -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_users.rb +16 -0
- data/test/integration/app/db/migrate/002_create_sellers.rb +14 -0
- data/test/integration/app/db/migrate/003_create_addresses.rb +19 -0
- data/test/integration/app/db/migrate/004_create_states.rb +12 -0
- data/test/integration/app/db/migrate/005_add_capitalization_to_seller.rb +9 -0
- data/test/integration/app/db/migrate/006_add_deleted_to_user.rb +9 -0
- data/test/integration/app/db/migrate/007_add_lat_and_long_to_address.rb +11 -0
- data/test/integration/app/db/migrate/008_create_citations.rb +12 -0
- data/test/integration/app/db/migrate/009_create_citations_items.rb +14 -0
- data/test/integration/app/db/schema.rb +144 -0
- data/test/integration/app/doc/README_FOR_APP +2 -0
- data/test/integration/app/generated_models/aquatic_fish.rb +109 -0
- data/test/integration/app/generated_models/aquatic_pupils_whale.rb +13 -0
- data/test/integration/app/generated_models/aquatic_whale.rb +42 -0
- data/test/integration/app/generated_models/beautiful_fight_relationship.rb +25 -0
- data/test/integration/app/generated_models/citation.rb +40 -0
- data/test/integration/app/generated_models/citations_item.rb +12 -0
- data/test/integration/app/generated_models/dog.rb +183 -0
- data/test/integration/app/generated_models/eaters_foodstuff.rb +13 -0
- data/test/integration/app/generated_models/frog.rb +78 -0
- data/test/integration/app/generated_models/kitten.rb +161 -0
- data/test/integration/app/generated_models/parentship.rb +14 -0
- data/test/integration/app/generated_models/person.rb +53 -0
- data/test/integration/app/generated_models/petfood.rb +125 -0
- data/test/integration/app/generated_models/polymorph_test_some_model.rb +25 -0
- data/test/integration/app/generated_models/seller.rb +30 -0
- data/test/integration/app/generated_models/tabby.rb +26 -0
- data/test/integration/app/generated_models/user.rb +34 -0
- data/test/integration/app/generated_models/wild_boar.rb +87 -0
- data/test/integration/app/generators/commenting_generator_test.rb +83 -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/addresses.yml +13 -0
- data/test/integration/app/test/fixtures/citations.yml +9 -0
- data/test/integration/app/test/fixtures/citations_items.yml +9 -0
- data/test/integration/app/test/fixtures/sellers.yml +10 -0
- data/test/integration/app/test/fixtures/states.yml +216 -0
- data/test/integration/app/test/fixtures/users.yml +11 -0
- data/test/integration/app/test/functional/addresses_controller_test.rb +57 -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 +28 -0
- data/test/integration/app/test/unit/address_test.rb +10 -0
- data/test/integration/app/test/unit/citation_test.rb +10 -0
- data/test/integration/app/test/unit/citations_item_test.rb +10 -0
- data/test/integration/app/test/unit/seller_test.rb +10 -0
- data/test/integration/app/test/unit/state_test.rb +10 -0
- data/test/integration/app/test/unit/user_test.rb +10 -0
- data/test/models/aquatic/fish.rb +2 -1
- data/test/models/aquatic/whale.rb +2 -0
- data/test/setup.rb +10 -0
- data/test/test_all.rb +16 -0
- data/test/test_helper.rb +16 -12
- data/test/unit/polymorph_test.rb +35 -34
- metadata +239 -98
- metadata.gz.sig +0 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
+
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/testtask'
|
8
|
+
require 'rake/rdoctask'
|
9
|
+
|
10
|
+
require 'tasks/rails'
|
11
|
+
|
12
|
+
namespace :test do
|
13
|
+
desc "a new rake task to include generators"
|
14
|
+
Rake::TestTask.new(:generators) do |t|
|
15
|
+
t.libs << 'lib'
|
16
|
+
t.test_files = FileList['test/generators/*_test.rb']
|
17
|
+
t.verbose = true
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
class AddressesController < ApplicationController
|
2
|
+
# GET /addresses
|
3
|
+
# GET /addresses.xml
|
4
|
+
def index
|
5
|
+
@addresses = Address.find(:all)
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.xml { render :xml => @addresses }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /addresses/1
|
14
|
+
# GET /addresses/1.xml
|
15
|
+
def show
|
16
|
+
@address = Address.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.xml { render :xml => @address }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /addresses/new
|
25
|
+
# GET /addresses/new.xml
|
26
|
+
def new
|
27
|
+
@address = Address.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.xml { render :xml => @address }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /addresses/1/edit
|
36
|
+
def edit
|
37
|
+
@address = Address.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /addresses
|
41
|
+
# POST /addresses.xml
|
42
|
+
def create
|
43
|
+
@address = Address.new(params[:address])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @address.save
|
47
|
+
flash[:notice] = 'Address was successfully created.'
|
48
|
+
format.html { redirect_to(@address) }
|
49
|
+
format.xml { render :xml => @address, :status => :created, :location => @address }
|
50
|
+
else
|
51
|
+
format.html { render :action => "new" }
|
52
|
+
format.xml { render :xml => @address.errors, :status => :unprocessable_entity }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT /addresses/1
|
58
|
+
# PUT /addresses/1.xml
|
59
|
+
def update
|
60
|
+
@address = Address.find(params[:id])
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @address.update_attributes(params[:address])
|
64
|
+
flash[:notice] = 'Address was successfully updated.'
|
65
|
+
format.html { redirect_to(@address) }
|
66
|
+
format.xml { head :ok }
|
67
|
+
else
|
68
|
+
format.html { render :action => "edit" }
|
69
|
+
format.xml { render :xml => @address.errors, :status => :unprocessable_entity }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# DELETE /addresses/1
|
75
|
+
# DELETE /addresses/1.xml
|
76
|
+
def destroy
|
77
|
+
@address = Address.find(params[:id])
|
78
|
+
@address.destroy
|
79
|
+
|
80
|
+
respond_to do |format|
|
81
|
+
format.html { redirect_to(addresses_url) }
|
82
|
+
format.xml { head :ok }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Filters added to this controller apply to all controllers in the application.
|
2
|
+
# Likewise, all the methods added will be available for all controllers.
|
3
|
+
|
4
|
+
class ApplicationController < ActionController::Base
|
5
|
+
# Pick a unique cookie name to distinguish our session data from others'
|
6
|
+
session :session_key => '_testapp_session_id'
|
7
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
class SellersController < ApplicationController
|
2
|
+
# GET /sellers
|
3
|
+
# GET /sellers.xml
|
4
|
+
def index
|
5
|
+
@sellers = Seller.find(:all)
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.xml { render :xml => @sellers }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /sellers/1
|
14
|
+
# GET /sellers/1.xml
|
15
|
+
def show
|
16
|
+
@seller = Seller.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.xml { render :xml => @seller }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /sellers/new
|
25
|
+
# GET /sellers/new.xml
|
26
|
+
def new
|
27
|
+
@seller = Seller.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.xml { render :xml => @seller }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /sellers/1/edit
|
36
|
+
def edit
|
37
|
+
@seller = Seller.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /sellers
|
41
|
+
# POST /sellers.xml
|
42
|
+
def create
|
43
|
+
@seller = Seller.new(params[:seller])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @seller.save
|
47
|
+
flash[:notice] = 'Seller was successfully created.'
|
48
|
+
format.html { redirect_to(@seller) }
|
49
|
+
format.xml { render :xml => @seller, :status => :created, :location => @seller }
|
50
|
+
else
|
51
|
+
format.html { render :action => "new" }
|
52
|
+
format.xml { render :xml => @seller.errors, :status => :unprocessable_entity }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT /sellers/1
|
58
|
+
# PUT /sellers/1.xml
|
59
|
+
def update
|
60
|
+
@seller = Seller.find(params[:id])
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @seller.update_attributes(params[:seller])
|
64
|
+
flash[:notice] = 'Seller was successfully updated.'
|
65
|
+
format.html { redirect_to(@seller) }
|
66
|
+
format.xml { head :ok }
|
67
|
+
else
|
68
|
+
format.html { render :action => "edit" }
|
69
|
+
format.xml { render :xml => @seller.errors, :status => :unprocessable_entity }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# DELETE /sellers/1
|
75
|
+
# DELETE /sellers/1.xml
|
76
|
+
def destroy
|
77
|
+
@seller = Seller.find(params[:id])
|
78
|
+
@seller.destroy
|
79
|
+
|
80
|
+
respond_to do |format|
|
81
|
+
format.html { redirect_to(sellers_url) }
|
82
|
+
format.xml { head :ok }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
class StatesController < ApplicationController
|
2
|
+
# GET /states
|
3
|
+
# GET /states.xml
|
4
|
+
def index
|
5
|
+
@states = State.find(:all)
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.xml { render :xml => @states }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /states/1
|
14
|
+
# GET /states/1.xml
|
15
|
+
def show
|
16
|
+
@state = State.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.xml { render :xml => @state }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /states/new
|
25
|
+
# GET /states/new.xml
|
26
|
+
def new
|
27
|
+
@state = State.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.xml { render :xml => @state }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /states/1/edit
|
36
|
+
def edit
|
37
|
+
@state = State.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /states
|
41
|
+
# POST /states.xml
|
42
|
+
def create
|
43
|
+
@state = State.new(params[:state])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @state.save
|
47
|
+
flash[:notice] = 'State was successfully created.'
|
48
|
+
format.html { redirect_to(@state) }
|
49
|
+
format.xml { render :xml => @state, :status => :created, :location => @state }
|
50
|
+
else
|
51
|
+
format.html { render :action => "new" }
|
52
|
+
format.xml { render :xml => @state.errors, :status => :unprocessable_entity }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT /states/1
|
58
|
+
# PUT /states/1.xml
|
59
|
+
def update
|
60
|
+
@state = State.find(params[:id])
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @state.update_attributes(params[:state])
|
64
|
+
flash[:notice] = 'State was successfully updated.'
|
65
|
+
format.html { redirect_to(@state) }
|
66
|
+
format.xml { head :ok }
|
67
|
+
else
|
68
|
+
format.html { render :action => "edit" }
|
69
|
+
format.xml { render :xml => @state.errors, :status => :unprocessable_entity }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# DELETE /states/1
|
75
|
+
# DELETE /states/1.xml
|
76
|
+
def destroy
|
77
|
+
@state = State.find(params[:id])
|
78
|
+
@state.destroy
|
79
|
+
|
80
|
+
respond_to do |format|
|
81
|
+
format.html { redirect_to(states_url) }
|
82
|
+
format.xml { head :ok }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
class UsersController < ApplicationController
|
2
|
+
# GET /users
|
3
|
+
# GET /users.xml
|
4
|
+
def index
|
5
|
+
@users = User.find(:all)
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.xml { render :xml => @users }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /users/1
|
14
|
+
# GET /users/1.xml
|
15
|
+
def show
|
16
|
+
@user = User.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.xml { render :xml => @user }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /users/new
|
25
|
+
# GET /users/new.xml
|
26
|
+
def new
|
27
|
+
@user = User.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.xml { render :xml => @user }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /users/1/edit
|
36
|
+
def edit
|
37
|
+
@user = User.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /users
|
41
|
+
# POST /users.xml
|
42
|
+
def create
|
43
|
+
@user = User.new(params[:user])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @user.save
|
47
|
+
flash[:notice] = 'User was successfully created.'
|
48
|
+
format.html { redirect_to(@user) }
|
49
|
+
format.xml { render :xml => @user, :status => :created, :location => @user }
|
50
|
+
else
|
51
|
+
format.html { render :action => "new" }
|
52
|
+
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT /users/1
|
58
|
+
# PUT /users/1.xml
|
59
|
+
def update
|
60
|
+
@user = User.find(params[:id])
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @user.update_attributes(params[:user])
|
64
|
+
flash[:notice] = 'User was successfully updated.'
|
65
|
+
format.html { redirect_to(@user) }
|
66
|
+
format.xml { head :ok }
|
67
|
+
else
|
68
|
+
format.html { render :action => "edit" }
|
69
|
+
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# DELETE /users/1
|
75
|
+
# DELETE /users/1.xml
|
76
|
+
def destroy
|
77
|
+
@user = User.find(params[:id])
|
78
|
+
@user.destroy
|
79
|
+
|
80
|
+
respond_to do |format|
|
81
|
+
format.html { redirect_to(users_url) }
|
82
|
+
format.xml { head :ok }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -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
|