acts_as_api_sequel 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +5 -0
- data/Gemfile +13 -0
- data/History.txt +108 -0
- data/README.md +126 -0
- data/Rakefile +48 -0
- data/acts_as_api.gemspec +28 -0
- data/examples/introduction/docco.css +186 -0
- data/examples/introduction/index.html +338 -0
- data/examples/introduction/index.rb +144 -0
- data/examples/introduction/layout.mustache +67 -0
- data/lib/acts_as_api.rb +46 -0
- data/lib/acts_as_api/adapters.rb +5 -0
- data/lib/acts_as_api/adapters/mongoid.rb +11 -0
- data/lib/acts_as_api/api_template.rb +139 -0
- data/lib/acts_as_api/array.rb +21 -0
- data/lib/acts_as_api/base.rb +88 -0
- data/lib/acts_as_api/config.rb +58 -0
- data/lib/acts_as_api/exceptions.rb +4 -0
- data/lib/acts_as_api/rails_renderer.rb +17 -0
- data/lib/acts_as_api/rendering.rb +95 -0
- data/lib/acts_as_api/responder.rb +39 -0
- data/lib/acts_as_api/version.rb +3 -0
- data/spec/README.md +55 -0
- data/spec/active_record_dummy/.gitignore +15 -0
- data/spec/active_record_dummy/Gemfile +16 -0
- data/spec/active_record_dummy/README.rdoc +261 -0
- data/spec/active_record_dummy/Rakefile +7 -0
- data/spec/active_record_dummy/app/assets/images/rails.png +0 -0
- data/spec/active_record_dummy/app/assets/javascripts/application.js +15 -0
- data/spec/active_record_dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/active_record_dummy/app/controllers/application_controller.rb +3 -0
- data/spec/active_record_dummy/app/helpers/application_helper.rb +2 -0
- data/spec/active_record_dummy/app/mailers/.gitkeep +0 -0
- data/spec/active_record_dummy/app/models/.gitkeep +0 -0
- data/spec/active_record_dummy/app/models/profile.rb +4 -0
- data/spec/active_record_dummy/app/models/task.rb +4 -0
- data/spec/active_record_dummy/app/models/untouched.rb +2 -0
- data/spec/active_record_dummy/app/models/user.rb +186 -0
- data/spec/active_record_dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/active_record_dummy/config.ru +4 -0
- data/spec/active_record_dummy/config/application.rb +59 -0
- data/spec/active_record_dummy/config/boot.rb +6 -0
- data/spec/active_record_dummy/config/database.yml +25 -0
- data/spec/active_record_dummy/config/environment.rb +5 -0
- data/spec/active_record_dummy/config/environments/development.rb +37 -0
- data/spec/active_record_dummy/config/environments/production.rb +67 -0
- data/spec/active_record_dummy/config/environments/test.rb +37 -0
- data/spec/active_record_dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/active_record_dummy/config/initializers/generators.rb +2 -0
- data/spec/active_record_dummy/config/initializers/inflections.rb +15 -0
- data/spec/active_record_dummy/config/initializers/mime_types.rb +5 -0
- data/spec/active_record_dummy/config/initializers/secret_token.rb +7 -0
- data/spec/active_record_dummy/config/initializers/session_store.rb +8 -0
- data/spec/active_record_dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/active_record_dummy/config/locales/en.yml +5 -0
- data/spec/active_record_dummy/config/routes.rb +59 -0
- data/spec/active_record_dummy/db/migrate/20110214201640_create_tables.rb +44 -0
- data/spec/active_record_dummy/db/schema.rb +47 -0
- data/spec/active_record_dummy/db/seeds.rb +7 -0
- data/spec/active_record_dummy/doc/README_FOR_APP +2 -0
- data/spec/active_record_dummy/lib/assets/.gitkeep +0 -0
- data/spec/active_record_dummy/lib/tasks/.gitkeep +0 -0
- data/spec/active_record_dummy/log/.gitkeep +0 -0
- data/spec/active_record_dummy/public/404.html +26 -0
- data/spec/active_record_dummy/public/422.html +26 -0
- data/spec/active_record_dummy/public/500.html +25 -0
- data/spec/active_record_dummy/public/favicon.ico +0 -0
- data/spec/active_record_dummy/public/index.html +241 -0
- data/spec/active_record_dummy/public/robots.txt +5 -0
- data/spec/active_record_dummy/script/rails +6 -0
- data/spec/active_record_dummy/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/active_record_dummy/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/active_record_dummy/vendor/plugins/.gitkeep +0 -0
- data/spec/controllers/plain_objects_controller_spec.rb +36 -0
- data/spec/controllers/respond_with_users_controller_spec.rb +142 -0
- data/spec/controllers/users_controller_spec.rb +15 -0
- data/spec/models/model_spec.rb +31 -0
- data/spec/mongoid_dummy/.gitignore +15 -0
- data/spec/mongoid_dummy/Gemfile +18 -0
- data/spec/mongoid_dummy/README.rdoc +261 -0
- data/spec/mongoid_dummy/Rakefile +7 -0
- data/spec/mongoid_dummy/app/assets/images/rails.png +0 -0
- data/spec/mongoid_dummy/app/assets/javascripts/application.js +15 -0
- data/spec/mongoid_dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/mongoid_dummy/app/controllers/application_controller.rb +3 -0
- data/spec/mongoid_dummy/app/helpers/application_helper.rb +2 -0
- data/spec/mongoid_dummy/app/mailers/.gitkeep +0 -0
- data/spec/mongoid_dummy/app/models/.gitkeep +0 -0
- data/spec/mongoid_dummy/app/models/profile.rb +10 -0
- data/spec/mongoid_dummy/app/models/task.rb +12 -0
- data/spec/mongoid_dummy/app/models/untouched.rb +7 -0
- data/spec/mongoid_dummy/app/models/user.rb +48 -0
- data/spec/mongoid_dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/mongoid_dummy/config.ru +4 -0
- data/spec/mongoid_dummy/config/application.rb +65 -0
- data/spec/mongoid_dummy/config/boot.rb +6 -0
- data/spec/mongoid_dummy/config/environment.rb +5 -0
- data/spec/mongoid_dummy/config/environments/development.rb +31 -0
- data/spec/mongoid_dummy/config/environments/production.rb +64 -0
- data/spec/mongoid_dummy/config/environments/test.rb +35 -0
- data/spec/mongoid_dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/mongoid_dummy/config/initializers/generators.rb +2 -0
- data/spec/mongoid_dummy/config/initializers/include_acts_as_api.rb +3 -0
- data/spec/mongoid_dummy/config/initializers/inflections.rb +15 -0
- data/spec/mongoid_dummy/config/initializers/mime_types.rb +5 -0
- data/spec/mongoid_dummy/config/initializers/secret_token.rb +7 -0
- data/spec/mongoid_dummy/config/initializers/session_store.rb +8 -0
- data/spec/mongoid_dummy/config/initializers/wrap_parameters.rb +10 -0
- data/spec/mongoid_dummy/config/locales/en.yml +5 -0
- data/spec/mongoid_dummy/config/mongoid.yml +120 -0
- data/spec/mongoid_dummy/config/routes.rb +59 -0
- data/spec/mongoid_dummy/db/seeds.rb +7 -0
- data/spec/mongoid_dummy/doc/README_FOR_APP +2 -0
- data/spec/mongoid_dummy/lib/assets/.gitkeep +0 -0
- data/spec/mongoid_dummy/lib/tasks/.gitkeep +0 -0
- data/spec/mongoid_dummy/log/.gitkeep +0 -0
- data/spec/mongoid_dummy/public/404.html +26 -0
- data/spec/mongoid_dummy/public/422.html +26 -0
- data/spec/mongoid_dummy/public/500.html +25 -0
- data/spec/mongoid_dummy/public/favicon.ico +0 -0
- data/spec/mongoid_dummy/public/index.html +241 -0
- data/spec/mongoid_dummy/public/robots.txt +5 -0
- data/spec/mongoid_dummy/script/rails +6 -0
- data/spec/mongoid_dummy/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/mongoid_dummy/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/mongoid_dummy/vendor/plugins/.gitkeep +0 -0
- data/spec/shared_engine/.gitignore +7 -0
- data/spec/shared_engine/Gemfile +14 -0
- data/spec/shared_engine/MIT-LICENSE +20 -0
- data/spec/shared_engine/README.rdoc +3 -0
- data/spec/shared_engine/Rakefile +29 -0
- data/spec/shared_engine/app/assets/images/shared_engine/.gitkeep +0 -0
- data/spec/shared_engine/app/assets/javascripts/shared_engine/application.js +15 -0
- data/spec/shared_engine/app/assets/stylesheets/shared_engine/application.css +13 -0
- data/spec/shared_engine/app/controllers/shared_engine/application_controller.rb +4 -0
- data/spec/shared_engine/app/controllers/shared_engine/plain_objects_controller.rb +14 -0
- data/spec/shared_engine/app/controllers/shared_engine/respond_with_users_controller.rb +64 -0
- data/spec/shared_engine/app/controllers/shared_engine/users_controller.rb +71 -0
- data/spec/shared_engine/app/helpers/shared_engine/application_helper.rb +4 -0
- data/spec/shared_engine/app/models/plain_object.rb +17 -0
- data/spec/shared_engine/app/models/user_template.rb +154 -0
- data/spec/shared_engine/app/views/layouts/shared_engine/application.html.erb +14 -0
- data/spec/shared_engine/config/routes.rb +28 -0
- data/spec/shared_engine/dummy/README.rdoc +261 -0
- data/spec/shared_engine/dummy/Rakefile +7 -0
- data/spec/shared_engine/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/shared_engine/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/shared_engine/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/shared_engine/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/shared_engine/dummy/app/mailers/.gitkeep +0 -0
- data/spec/shared_engine/dummy/app/models/.gitkeep +0 -0
- data/spec/shared_engine/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/shared_engine/dummy/config.ru +4 -0
- data/spec/shared_engine/dummy/config/application.rb +62 -0
- data/spec/shared_engine/dummy/config/boot.rb +10 -0
- data/spec/shared_engine/dummy/config/database.yml +25 -0
- data/spec/shared_engine/dummy/config/environment.rb +5 -0
- data/spec/shared_engine/dummy/config/environments/development.rb +37 -0
- data/spec/shared_engine/dummy/config/environments/production.rb +67 -0
- data/spec/shared_engine/dummy/config/environments/test.rb +37 -0
- data/spec/shared_engine/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/shared_engine/dummy/config/initializers/inflections.rb +15 -0
- data/spec/shared_engine/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/shared_engine/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/shared_engine/dummy/config/initializers/session_store.rb +8 -0
- data/spec/shared_engine/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/shared_engine/dummy/config/locales/en.yml +5 -0
- data/spec/shared_engine/dummy/config/routes.rb +4 -0
- data/spec/shared_engine/dummy/lib/assets/.gitkeep +0 -0
- data/spec/shared_engine/dummy/log/.gitkeep +0 -0
- data/spec/shared_engine/dummy/public/404.html +26 -0
- data/spec/shared_engine/dummy/public/422.html +26 -0
- data/spec/shared_engine/dummy/public/500.html +25 -0
- data/spec/shared_engine/dummy/public/favicon.ico +0 -0
- data/spec/shared_engine/dummy/script/rails +6 -0
- data/spec/shared_engine/lib/magic/rails/engine.rb +69 -0
- data/spec/shared_engine/lib/shared_engine.rb +4 -0
- data/spec/shared_engine/lib/shared_engine/engine.rb +5 -0
- data/spec/shared_engine/lib/shared_engine/version.rb +3 -0
- data/spec/shared_engine/lib/tasks/shared_engine_tasks.rake +4 -0
- data/spec/shared_engine/script/rails +8 -0
- data/spec/shared_engine/shared_engine.gemspec +22 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/support/api_test_helpers.rb +23 -0
- data/spec/support/controller_examples.rb +458 -0
- data/spec/support/it_supports.rb +3 -0
- data/spec/support/model_examples/associations.rb +272 -0
- data/spec/support/model_examples/callbacks.rb +38 -0
- data/spec/support/model_examples/closures.rb +49 -0
- data/spec/support/model_examples/conditional_if.rb +165 -0
- data/spec/support/model_examples/conditional_unless.rb +165 -0
- data/spec/support/model_examples/enabled.rb +10 -0
- data/spec/support/model_examples/extending.rb +112 -0
- data/spec/support/model_examples/methods.rb +23 -0
- data/spec/support/model_examples/options.rb +53 -0
- data/spec/support/model_examples/renaming.rb +50 -0
- data/spec/support/model_examples/simple.rb +23 -0
- data/spec/support/model_examples/sub_nodes.rb +105 -0
- data/spec/support/model_examples/undefined.rb +7 -0
- data/spec/support/model_examples/untouched.rb +13 -0
- data/spec/support/routing.rb +4 -0
- data/spec/support/simple_fixtures.rb +59 -0
- metadata +499 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
4
|
+
|
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
|
6
|
+
|
|
7
|
+
ActiveRecordDummy::Application.load_tasks
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// the compiled file.
|
|
9
|
+
//
|
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
|
12
|
+
//
|
|
13
|
+
//= require jquery
|
|
14
|
+
//= require jquery_ujs
|
|
15
|
+
//= require_tree .
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
|
10
|
+
*
|
|
11
|
+
*= require_self
|
|
12
|
+
*= require_tree .
|
|
13
|
+
*/
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
class User < ActiveRecord::Base
|
|
2
|
+
attr_accessible :first_name, :last_name, :age, :active
|
|
3
|
+
validates :first_name, :last_name, :presence => true
|
|
4
|
+
|
|
5
|
+
has_many :tasks
|
|
6
|
+
|
|
7
|
+
has_one :profile
|
|
8
|
+
|
|
9
|
+
acts_as_api
|
|
10
|
+
|
|
11
|
+
api_accessible :name_only do |t|
|
|
12
|
+
t.add :first_name
|
|
13
|
+
t.add :last_name
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
api_accessible :only_full_name do |t|
|
|
17
|
+
t.add :full_name
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
api_accessible :rename_last_name do |t|
|
|
21
|
+
t.add :last_name, :as => :family_name
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
api_accessible :rename_full_name do |t|
|
|
25
|
+
t.add :full_name, :as => :other_full_name
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
api_accessible :with_former_value do |t|
|
|
29
|
+
t.add :first_name
|
|
30
|
+
t.add :last_name
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
api_accessible :age_and_first_name, :extend => :with_former_value do |t|
|
|
34
|
+
t.add :age
|
|
35
|
+
t.remove :last_name
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
api_accessible :calling_a_proc do |t|
|
|
39
|
+
t.add Proc.new{|model| model.full_name.upcase }, :as => :all_caps_name
|
|
40
|
+
t.add Proc.new{|model| Time.now.class.to_s }, :as => :without_param
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
api_accessible :calling_a_lambda do |t|
|
|
44
|
+
t.add lambda{|model| model.full_name.upcase }, :as => :all_caps_name
|
|
45
|
+
t.add lambda{|model| Time.now.class.to_s }, :as => :without_param
|
|
46
|
+
end
|
|
47
|
+
api_accessible :include_tasks do |t|
|
|
48
|
+
t.add :tasks
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
api_accessible :include_profile do |t|
|
|
52
|
+
t.add :profile
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
api_accessible :other_sub_template do |t|
|
|
56
|
+
t.add :first_name
|
|
57
|
+
t.add :tasks, :template => :other_template
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
api_accessible :include_completed_tasks do |t|
|
|
61
|
+
t.add "tasks.completed.all", :as => :completed_tasks
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
api_accessible :sub_node do |t|
|
|
65
|
+
t.add Hash[:foo => :say_something], :as => :sub_nodes
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
api_accessible :nested_sub_node do |t|
|
|
69
|
+
t.add Hash[:foo, Hash[:bar, :last_name]], :as => :sub_nodes
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
api_accessible :nested_sub_hash do |t|
|
|
73
|
+
t.add :sub_hash
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
api_accessible :if_over_thirty do |t|
|
|
77
|
+
t.add :first_name
|
|
78
|
+
t.add :last_name, :if => :over_thirty?
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
api_accessible :if_returns_nil do |t|
|
|
82
|
+
t.add :first_name
|
|
83
|
+
t.add :last_name, :if => :return_nil
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
api_accessible :if_over_thirty_proc do |t|
|
|
87
|
+
t.add :first_name
|
|
88
|
+
t.add :last_name, :if => lambda{|u| u.over_thirty? }
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
api_accessible :if_returns_nil_proc do |t|
|
|
92
|
+
t.add :first_name
|
|
93
|
+
t.add :last_name, :if => lambda{|u| nil }
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
api_accessible :unless_under_thirty do |t|
|
|
97
|
+
t.add :first_name
|
|
98
|
+
t.add :last_name, :unless => :under_thirty?
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
api_accessible :unless_returns_nil do |t|
|
|
102
|
+
t.add :first_name
|
|
103
|
+
t.add :last_name, :unless => :return_nil
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
api_accessible :unless_under_thirty_proc do |t|
|
|
107
|
+
t.add :first_name
|
|
108
|
+
t.add :last_name, :unless => lambda{|u| u.under_thirty? }
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
api_accessible :unless_returns_nil_proc do |t|
|
|
112
|
+
t.add :first_name
|
|
113
|
+
t.add :last_name, :unless => lambda{|u| nil }
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
api_accessible :with_prefix_name_only do |t|
|
|
117
|
+
t.add lambda{|model| 'true' }, :as => :prefix
|
|
118
|
+
t.add :first_name
|
|
119
|
+
t.add :last_name
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
api_accessible :name_only_with_postfix do |t|
|
|
123
|
+
t.add :first_name
|
|
124
|
+
t.add :last_name
|
|
125
|
+
t.add lambda{|model| 'true' }, :as => :postfix
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
api_accessible :with_prefix_name_only_with_postfix do |t|
|
|
129
|
+
t.add lambda{|model| 'true' }, :as => :prefix
|
|
130
|
+
t.add :first_name
|
|
131
|
+
t.add :last_name
|
|
132
|
+
t.add lambda{|model| 'true' }, :as => :postfix
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def before_api_response(api_response)
|
|
136
|
+
@before_api_response_called = true
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def before_api_response_called?
|
|
140
|
+
!!@before_api_response_called
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def after_api_response(api_response)
|
|
144
|
+
@after_api_response_called = true
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def after_api_response_called?
|
|
148
|
+
!!@after_api_response_called
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def skip_api_response=(should_skip)
|
|
152
|
+
@skip_api_response = should_skip
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def around_api_response(api_response)
|
|
156
|
+
@skip_api_response ? { :skipped => true } : yield
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def over_thirty?
|
|
160
|
+
age > 30
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def under_thirty?
|
|
164
|
+
age < 30
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def return_nil
|
|
168
|
+
nil
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def full_name
|
|
172
|
+
'' << first_name.to_s << ' ' << last_name.to_s
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def say_something
|
|
176
|
+
"something"
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def sub_hash
|
|
180
|
+
{
|
|
181
|
+
:foo => "bar",
|
|
182
|
+
:hello => "world"
|
|
183
|
+
}
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>ActiveRecordDummy</title>
|
|
5
|
+
<%= stylesheet_link_tag "application", :media => "all" %>
|
|
6
|
+
<%= javascript_include_tag "application" %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
require 'rails/all'
|
|
4
|
+
|
|
5
|
+
if defined?(Bundler)
|
|
6
|
+
# If you precompile assets before deploying to production, use this line
|
|
7
|
+
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
|
8
|
+
# If you want your assets lazily compiled in production, use this line
|
|
9
|
+
# Bundler.require(:default, :assets, Rails.env)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module ActiveRecordDummy
|
|
13
|
+
class Application < Rails::Application
|
|
14
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
15
|
+
# Application configuration should go into files in config/initializers
|
|
16
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
17
|
+
|
|
18
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
|
19
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
|
20
|
+
|
|
21
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
|
22
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
|
23
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
24
|
+
|
|
25
|
+
# Activate observers that should always be running.
|
|
26
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
|
27
|
+
|
|
28
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
29
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
30
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
31
|
+
|
|
32
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
33
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
34
|
+
# config.i18n.default_locale = :de
|
|
35
|
+
|
|
36
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
|
37
|
+
config.encoding = "utf-8"
|
|
38
|
+
|
|
39
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
|
40
|
+
config.filter_parameters += [:password]
|
|
41
|
+
|
|
42
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
|
43
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
44
|
+
# like if you have constraints or database-specific column types
|
|
45
|
+
# config.active_record.schema_format = :sql
|
|
46
|
+
|
|
47
|
+
# Enforce whitelist mode for mass assignment.
|
|
48
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
|
49
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
|
50
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
|
51
|
+
config.active_record.whitelist_attributes = true
|
|
52
|
+
|
|
53
|
+
# Enable the asset pipeline
|
|
54
|
+
config.assets.enabled = true
|
|
55
|
+
|
|
56
|
+
# Version of your assets, change this if you want to expire all your assets
|
|
57
|
+
config.assets.version = '1.0'
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# SQLite version 3.x
|
|
2
|
+
# gem install sqlite3
|
|
3
|
+
#
|
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
|
5
|
+
# gem 'sqlite3'
|
|
6
|
+
development:
|
|
7
|
+
adapter: sqlite3
|
|
8
|
+
database: db/development.sqlite3
|
|
9
|
+
pool: 5
|
|
10
|
+
timeout: 5000
|
|
11
|
+
|
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
|
13
|
+
# re-generated from your development database when you run "rake".
|
|
14
|
+
# Do not set this db to the same as development or production.
|
|
15
|
+
test:
|
|
16
|
+
adapter: sqlite3
|
|
17
|
+
database: db/test.sqlite3
|
|
18
|
+
pool: 5
|
|
19
|
+
timeout: 5000
|
|
20
|
+
|
|
21
|
+
production:
|
|
22
|
+
adapter: sqlite3
|
|
23
|
+
database: db/production.sqlite3
|
|
24
|
+
pool: 5
|
|
25
|
+
timeout: 5000
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
ActiveRecordDummy::Application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
|
3
|
+
|
|
4
|
+
# In the development environment your application's code is reloaded on
|
|
5
|
+
# every request. This slows down response time but is perfect for development
|
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
|
7
|
+
config.cache_classes = false
|
|
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.consider_all_requests_local = true
|
|
14
|
+
config.action_controller.perform_caching = false
|
|
15
|
+
|
|
16
|
+
# Don't care if the mailer can't send
|
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
|
18
|
+
|
|
19
|
+
# Print deprecation notices to the Rails logger
|
|
20
|
+
config.active_support.deprecation = :log
|
|
21
|
+
|
|
22
|
+
# Only use best-standards-support built into browsers
|
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
|
24
|
+
|
|
25
|
+
# Raise exception on mass assignment protection for Active Record models
|
|
26
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
|
27
|
+
|
|
28
|
+
# Log the query plan for queries taking more than this (works
|
|
29
|
+
# with SQLite, MySQL, and PostgreSQL)
|
|
30
|
+
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
|
31
|
+
|
|
32
|
+
# Do not compress assets
|
|
33
|
+
config.assets.compress = false
|
|
34
|
+
|
|
35
|
+
# Expands the lines which load the assets
|
|
36
|
+
config.assets.debug = true
|
|
37
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
ActiveRecordDummy::Application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
|
3
|
+
|
|
4
|
+
# Code is not reloaded between requests
|
|
5
|
+
config.cache_classes = true
|
|
6
|
+
|
|
7
|
+
# Full error reports are disabled and caching is turned on
|
|
8
|
+
config.consider_all_requests_local = false
|
|
9
|
+
config.action_controller.perform_caching = true
|
|
10
|
+
|
|
11
|
+
# Disable Rails's static asset server (Apache or nginx will already do this)
|
|
12
|
+
config.serve_static_assets = false
|
|
13
|
+
|
|
14
|
+
# Compress JavaScripts and CSS
|
|
15
|
+
config.assets.compress = true
|
|
16
|
+
|
|
17
|
+
# Don't fallback to assets pipeline if a precompiled asset is missed
|
|
18
|
+
config.assets.compile = false
|
|
19
|
+
|
|
20
|
+
# Generate digests for assets URLs
|
|
21
|
+
config.assets.digest = true
|
|
22
|
+
|
|
23
|
+
# Defaults to Rails.root.join("public/assets")
|
|
24
|
+
# config.assets.manifest = YOUR_PATH
|
|
25
|
+
|
|
26
|
+
# Specifies the header that your server uses for sending files
|
|
27
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
|
28
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
|
29
|
+
|
|
30
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
31
|
+
# config.force_ssl = true
|
|
32
|
+
|
|
33
|
+
# See everything in the log (default is :info)
|
|
34
|
+
# config.log_level = :debug
|
|
35
|
+
|
|
36
|
+
# Prepend all log lines with the following tags
|
|
37
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
|
38
|
+
|
|
39
|
+
# Use a different logger for distributed setups
|
|
40
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
|
41
|
+
|
|
42
|
+
# Use a different cache store in production
|
|
43
|
+
# config.cache_store = :mem_cache_store
|
|
44
|
+
|
|
45
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
|
46
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
|
47
|
+
|
|
48
|
+
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
|
49
|
+
# config.assets.precompile += %w( search.js )
|
|
50
|
+
|
|
51
|
+
# Disable delivery errors, bad email addresses will be ignored
|
|
52
|
+
# config.action_mailer.raise_delivery_errors = false
|
|
53
|
+
|
|
54
|
+
# Enable threaded mode
|
|
55
|
+
# config.threadsafe!
|
|
56
|
+
|
|
57
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
58
|
+
# the I18n.default_locale when a translation can not be found)
|
|
59
|
+
config.i18n.fallbacks = true
|
|
60
|
+
|
|
61
|
+
# Send deprecation notices to registered listeners
|
|
62
|
+
config.active_support.deprecation = :notify
|
|
63
|
+
|
|
64
|
+
# Log the query plan for queries taking more than this (works
|
|
65
|
+
# with SQLite, MySQL, and PostgreSQL)
|
|
66
|
+
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
|
67
|
+
end
|