active_scaffold 3.7.12 → 4.0.0.rc1
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 +4 -4
- data/CHANGELOG.rdoc +9 -23
- data/README.md +3 -2
- data/app/assets/config/active_scaffold_manifest.js +3 -0
- data/app/assets/javascripts/active_scaffold.js.erb +24 -34
- data/app/assets/javascripts/jquery/active_scaffold.js +41 -58
- data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +1 -1
- data/app/assets/stylesheets/active_scaffold_colors.scss +0 -7
- data/app/assets/stylesheets/active_scaffold_extensions.css.erb +2 -2
- data/app/assets/stylesheets/active_scaffold_jquery_ui.css.erb +7 -7
- data/app/assets/stylesheets/active_scaffold_layout.css +57 -30
- data/app/views/active_scaffold_overrides/_add_existing_form.html.erb +10 -10
- data/app/views/active_scaffold_overrides/_base_form.html.erb +21 -21
- data/app/views/active_scaffold_overrides/_create_form.html.erb +10 -7
- data/app/views/active_scaffold_overrides/_create_form_on_list.html.erb +5 -5
- data/app/views/active_scaffold_overrides/_field_search.html.erb +6 -6
- data/app/views/active_scaffold_overrides/_form.html.erb +11 -14
- data/app/views/active_scaffold_overrides/_form_association.html.erb +21 -12
- data/app/views/active_scaffold_overrides/_form_association_footer.html.erb +19 -10
- data/app/views/active_scaffold_overrides/_form_association_record.html.erb +15 -21
- data/app/views/active_scaffold_overrides/_form_messages.html.erb +2 -2
- data/app/views/active_scaffold_overrides/_horizontal_subform.html.erb +7 -6
- data/app/views/active_scaffold_overrides/_human_conditions.html.erb +2 -2
- data/app/views/active_scaffold_overrides/_list.html.erb +15 -8
- data/app/views/active_scaffold_overrides/_list_calculations.html.erb +2 -3
- data/app/views/active_scaffold_overrides/_list_header.html.erb +2 -2
- data/app/views/active_scaffold_overrides/_list_inline_adapter.html.erb +5 -5
- data/app/views/active_scaffold_overrides/_list_messages.html.erb +12 -3
- data/app/views/active_scaffold_overrides/_list_pagination.html.erb +3 -3
- data/app/views/active_scaffold_overrides/_list_pagination_links.html.erb +4 -4
- data/app/views/active_scaffold_overrides/_list_record.html.erb +6 -6
- data/app/views/active_scaffold_overrides/_list_with_header.html.erb +4 -4
- data/app/views/active_scaffold_overrides/_messages.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_refresh_list.js.erb +2 -2
- data/app/views/active_scaffold_overrides/_render_field.js.erb +4 -4
- data/app/views/active_scaffold_overrides/_row.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_search.html.erb +6 -5
- data/app/views/active_scaffold_overrides/_show.html.erb +3 -3
- data/app/views/active_scaffold_overrides/_show_actions.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_show_association.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_show_association_horizontal.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_show_association_vertical.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_show_columns.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_show_horizontal_record.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_update_actions.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_update_calculations.js.erb +2 -2
- data/app/views/active_scaffold_overrides/_update_column.js.erb +8 -7
- data/app/views/active_scaffold_overrides/_update_form.html.erb +5 -5
- data/app/views/active_scaffold_overrides/_update_messages.js.erb +1 -1
- data/app/views/active_scaffold_overrides/_vertical_subform.html.erb +4 -3
- data/app/views/active_scaffold_overrides/action_confirmation.html.erb +3 -3
- data/app/views/active_scaffold_overrides/add_existing.js.erb +6 -6
- data/app/views/active_scaffold_overrides/add_existing_form.html.erb +1 -1
- data/app/views/active_scaffold_overrides/add_tab.js.erb +15 -0
- data/app/views/active_scaffold_overrides/create.html.erb +1 -1
- data/app/views/active_scaffold_overrides/delete.html.erb +4 -4
- data/app/views/active_scaffold_overrides/destroy.js.erb +15 -13
- data/app/views/active_scaffold_overrides/edit_associated.js.erb +3 -3
- data/app/views/active_scaffold_overrides/field_search.html.erb +1 -1
- data/app/views/active_scaffold_overrides/form_messages.js.erb +1 -1
- data/app/views/active_scaffold_overrides/list.html.erb +1 -1
- data/app/views/active_scaffold_overrides/on_action_update.js.erb +13 -8
- data/app/views/active_scaffold_overrides/on_create.js.erb +34 -6
- data/app/views/active_scaffold_overrides/on_mark.js.erb +3 -3
- data/app/views/active_scaffold_overrides/on_update.js.erb +9 -9
- data/app/views/active_scaffold_overrides/render_field.js.erb +1 -1
- data/app/views/active_scaffold_overrides/render_field_inplace.html.erb +1 -1
- data/app/views/active_scaffold_overrides/row.js.erb +2 -2
- data/app/views/active_scaffold_overrides/search.html.erb +1 -1
- data/app/views/active_scaffold_overrides/show.html.erb +3 -3
- data/app/views/active_scaffold_overrides/update.html.erb +2 -2
- data/app/views/active_scaffold_overrides/update_column.js.erb +4 -4
- data/app/views/active_scaffold_overrides/update_row.js.erb +1 -1
- data/lib/active_scaffold/actions/common_search.rb +5 -3
- data/lib/active_scaffold/actions/core.rb +57 -32
- data/lib/active_scaffold/actions/create.rb +19 -17
- data/lib/active_scaffold/actions/delete.rb +10 -12
- data/lib/active_scaffold/actions/field_search.rb +28 -13
- data/lib/active_scaffold/actions/list.rb +34 -34
- data/lib/active_scaffold/actions/mark.rb +5 -5
- data/lib/active_scaffold/actions/nested.rb +64 -56
- data/lib/active_scaffold/actions/search.rb +2 -2
- data/lib/active_scaffold/actions/show.rb +5 -5
- data/lib/active_scaffold/actions/subform.rb +15 -4
- data/lib/active_scaffold/actions/update.rb +20 -20
- data/lib/active_scaffold/active_record_permissions.rb +4 -3
- data/lib/active_scaffold/attribute_params.rb +51 -50
- data/lib/active_scaffold/bridges/active_storage/active_storage_bridge.rb +4 -4
- data/lib/active_scaffold/bridges/active_storage/active_storage_helpers.rb +6 -2
- data/lib/active_scaffold/bridges/active_storage.rb +1 -1
- data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +3 -3
- data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +4 -1
- data/lib/active_scaffold/bridges/bitfields.rb +1 -1
- data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +9 -8
- data/lib/active_scaffold/bridges/cancan.rb +8 -8
- data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +1 -1
- data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +4 -3
- data/lib/active_scaffold/bridges/carrierwave.rb +2 -2
- data/lib/active_scaffold/bridges/chosen.rb +1 -5
- data/lib/active_scaffold/bridges/country_select/country_select_bridge_helper.rb +4 -2
- data/lib/active_scaffold/bridges/date_picker/ext.rb +20 -12
- data/lib/active_scaffold/bridges/date_picker/helper.rb +37 -33
- data/lib/active_scaffold/bridges/date_picker.rb +1 -4
- data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +1 -1
- data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +3 -2
- data/lib/active_scaffold/bridges/dragonfly.rb +1 -1
- data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +3 -2
- data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +2 -1
- data/lib/active_scaffold/bridges/file_column/form_ui.rb +4 -9
- data/lib/active_scaffold/bridges/file_column/list_ui.rb +6 -3
- data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +3 -3
- data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +1 -4
- data/lib/active_scaffold/bridges/file_column.rb +1 -0
- data/lib/active_scaffold/bridges/paper_trail/actions.rb +4 -2
- data/lib/active_scaffold/bridges/paper_trail/config.rb +1 -1
- data/lib/active_scaffold/bridges/paper_trail/helper.rb +1 -1
- data/lib/active_scaffold/bridges/paper_trail/paper_trail_bridge.rb +2 -1
- data/lib/active_scaffold/bridges/paperclip/list_ui.rb +3 -2
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +1 -1
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +10 -9
- data/lib/active_scaffold/bridges/paperclip.rb +2 -1
- data/lib/active_scaffold/bridges/record_select/helpers.rb +10 -11
- data/lib/active_scaffold/bridges/semantic_attributes/column.rb +3 -1
- data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +3 -7
- data/lib/active_scaffold/bridges/tiny_mce.rb +2 -7
- data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +7 -7
- data/lib/active_scaffold/bridges.rb +7 -5
- data/lib/active_scaffold/config/base.rb +20 -24
- data/lib/active_scaffold/config/core.rb +27 -39
- data/lib/active_scaffold/config/create.rb +1 -1
- data/lib/active_scaffold/config/delete.rb +9 -9
- data/lib/active_scaffold/config/field_search.rb +4 -9
- data/lib/active_scaffold/config/form.rb +3 -1
- data/lib/active_scaffold/config/list.rb +19 -15
- data/lib/active_scaffold/config/nested.rb +2 -2
- data/lib/active_scaffold/config/search.rb +5 -5
- data/lib/active_scaffold/config/show.rb +1 -1
- data/lib/active_scaffold/config/subform.rb +1 -1
- data/lib/active_scaffold/config/update.rb +4 -5
- data/lib/active_scaffold/configurable.rb +2 -1
- data/lib/active_scaffold/constraints.rb +16 -11
- data/lib/active_scaffold/core.rb +25 -27
- data/lib/active_scaffold/data_structures/action_columns.rb +10 -3
- data/lib/active_scaffold/data_structures/action_link.rb +19 -9
- data/lib/active_scaffold/data_structures/action_links.rb +20 -26
- data/lib/active_scaffold/data_structures/actions.rb +3 -3
- data/lib/active_scaffold/data_structures/association/abstract.rb +8 -4
- data/lib/active_scaffold/data_structures/association/active_mongoid.rb +1 -0
- data/lib/active_scaffold/data_structures/association/active_record.rb +1 -4
- data/lib/active_scaffold/data_structures/column.rb +368 -327
- data/lib/active_scaffold/data_structures/columns.rb +3 -2
- data/lib/active_scaffold/data_structures/nested_info.rb +6 -5
- data/lib/active_scaffold/data_structures/proxy_column.rb +68 -0
- data/lib/active_scaffold/data_structures/set.rb +7 -4
- data/lib/active_scaffold/data_structures/sorting.rb +21 -12
- data/lib/active_scaffold/engine.rb +12 -12
- data/lib/active_scaffold/extensions/action_controller_rendering.rb +5 -5
- data/lib/active_scaffold/extensions/action_controller_rescueing.rb +1 -1
- data/lib/active_scaffold/extensions/action_view_rendering.rb +29 -31
- data/lib/active_scaffold/extensions/ice_nine.rb +2 -1
- data/lib/active_scaffold/extensions/localize.rb +2 -2
- data/lib/active_scaffold/extensions/name_option_for_datetime.rb +1 -1
- data/lib/active_scaffold/extensions/routing_mapper.rb +5 -4
- data/lib/active_scaffold/extensions/unsaved_associated.rb +3 -2
- data/lib/active_scaffold/finder.rb +71 -78
- data/lib/active_scaffold/helpers/action_link_helpers.rb +37 -49
- data/lib/active_scaffold/helpers/association_helpers.rb +3 -2
- data/lib/active_scaffold/helpers/controller_helpers.rb +18 -16
- data/lib/active_scaffold/helpers/form_column_helpers.rb +69 -53
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +17 -15
- data/lib/active_scaffold/helpers/id_helpers.rb +5 -5
- data/lib/active_scaffold/helpers/list_column_helpers.rb +35 -38
- data/lib/active_scaffold/helpers/pagination_helpers.rb +4 -4
- data/lib/active_scaffold/helpers/search_column_helpers.rb +25 -34
- data/lib/active_scaffold/helpers/show_column_helpers.rb +7 -4
- data/lib/active_scaffold/helpers/tabs_helpers.rb +88 -0
- data/lib/active_scaffold/helpers/view_helpers.rb +15 -13
- data/lib/active_scaffold/marked_model.rb +1 -2
- data/lib/active_scaffold/orm_checks.rb +6 -4
- data/lib/active_scaffold/paginator.rb +3 -2
- data/lib/active_scaffold/registry.rb +5 -0
- data/lib/active_scaffold/tableless.rb +24 -14
- data/lib/active_scaffold/version.rb +4 -4
- data/lib/active_scaffold.rb +8 -34
- data/lib/generators/active_scaffold/controller_generator.rb +20 -20
- data/lib/generators/active_scaffold/install_generator.rb +4 -8
- data/lib/generators/active_scaffold/resource_generator.rb +31 -31
- data/lib/tasks/brakeman.rake +1 -1
- data/shoulda_macros/macros.rb +14 -14
- metadata +11 -232
- data/app/assets/javascripts/prototype/active_scaffold.js +0 -1249
- data/app/assets/javascripts/prototype/active_scaffold_chosen.js +0 -0
- data/app/assets/javascripts/prototype/dhtml_history.js +0 -870
- data/app/assets/javascripts/prototype/form_enhancements.js +0 -117
- data/app/assets/javascripts/prototype/tiny_mce_bridge.js +0 -17
- data/app/views/active_scaffold_overrides/_list_messages_content.html.erb +0 -8
- data/app/views/active_scaffold_overrides/_new_record.js.erb +0 -15
- data/app/views/active_scaffold_overrides/_popup_adapter.html.erb +0 -20
- data/app/views/active_scaffold_overrides/_refresh_create_form.js.erb +0 -12
- data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +0 -58
- data/lib/active_scaffold/bridges/calendar_date_select.rb +0 -17
- data/lib/active_scaffold/data_structures/action_link_separator.rb +0 -13
- data/lib/active_scaffold/extensions/cow_proxy.rb +0 -102
- data/test/active_scaffold_config_mock.rb +0 -33
- data/test/bridges/bridge_test.rb +0 -88
- data/test/bridges/date_picker_test.rb +0 -31
- data/test/bridges/paper_trail_test.rb +0 -16
- data/test/bridges/paperclip_test.rb +0 -85
- data/test/bridges/tiny_mce_test.rb +0 -61
- data/test/class_with_finder.rb +0 -42
- data/test/company.rb +0 -97
- data/test/config/base_test.rb +0 -17
- data/test/config/core_test.rb +0 -66
- data/test/config/create_test.rb +0 -72
- data/test/config/delete_test.rb +0 -35
- data/test/config/field_search_test.rb +0 -49
- data/test/config/list_test.rb +0 -134
- data/test/config/nested_test.rb +0 -55
- data/test/config/search_test.rb +0 -62
- data/test/config/show_test.rb +0 -45
- data/test/config/subform_test.rb +0 -19
- data/test/config/update_test.rb +0 -52
- data/test/const_mocker.rb +0 -32
- data/test/data_structures/action_columns_test.rb +0 -112
- data/test/data_structures/action_link_test.rb +0 -79
- data/test/data_structures/action_links_test.rb +0 -78
- data/test/data_structures/actions_test.rb +0 -25
- data/test/data_structures/association_column_test.rb +0 -41
- data/test/data_structures/column_test.rb +0 -186
- data/test/data_structures/columns_test.rb +0 -68
- data/test/data_structures/set_test.rb +0 -84
- data/test/data_structures/sorting_test.rb +0 -148
- data/test/data_structures/standard_column_test.rb +0 -23
- data/test/data_structures/validation_reflection_test.rb +0 -69
- data/test/data_structures/virtual_column_test.rb +0 -23
- data/test/extensions/action_view_rendering_test.rb +0 -20
- data/test/extensions/active_record_test.rb +0 -44
- data/test/extensions/routing_mapper_test.rb +0 -73
- data/test/helpers/form_column_helpers_test.rb +0 -34
- data/test/helpers/list_column_helpers_test.rb +0 -53
- data/test/helpers/pagination_helpers_test.rb +0 -65
- data/test/helpers/search_column_helpers_test.rb +0 -15
- data/test/misc/active_record_permissions_test.rb +0 -193
- data/test/misc/attribute_params_test.rb +0 -460
- data/test/misc/calculation_test.rb +0 -39
- data/test/misc/configurable_test.rb +0 -97
- data/test/misc/constraints_test.rb +0 -209
- data/test/misc/convert_numbers_format_test.rb +0 -171
- data/test/misc/finder_test.rb +0 -124
- data/test/misc/lang_test.rb +0 -10
- data/test/misc/parse_datetime_test.rb +0 -159
- data/test/misc/render_test.rb +0 -9
- data/test/misc/tableless_test.rb +0 -56
- data/test/mock_app/.gitignore +0 -2
- data/test/mock_app/Rakefile +0 -7
- data/test/mock_app/app/assets/config/manifest.js +0 -0
- data/test/mock_app/app/controllers/addresses_controller.rb +0 -4
- data/test/mock_app/app/controllers/application_controller.rb +0 -10
- data/test/mock_app/app/controllers/buildings_controller.rb +0 -4
- data/test/mock_app/app/controllers/cars_controller.rb +0 -5
- data/test/mock_app/app/controllers/contacts_controller.rb +0 -4
- data/test/mock_app/app/controllers/floors_controller.rb +0 -6
- data/test/mock_app/app/controllers/people_controller.rb +0 -8
- data/test/mock_app/app/controllers/roles_controller.rb +0 -4
- data/test/mock_app/app/helpers/application_helper.rb +0 -3
- data/test/mock_app/app/models/address.rb +0 -3
- data/test/mock_app/app/models/building.rb +0 -9
- data/test/mock_app/app/models/car.rb +0 -3
- data/test/mock_app/app/models/contact.rb +0 -3
- data/test/mock_app/app/models/file_model.rb +0 -31
- data/test/mock_app/app/models/floor.rb +0 -8
- data/test/mock_app/app/models/person.rb +0 -12
- data/test/mock_app/app/models/role.rb +0 -3
- data/test/mock_app/app/views/active_scaffold_overrides/_form.html.erb +0 -2
- data/test/mock_app/app/views/active_scaffold_overrides/list.html.erb +0 -2
- data/test/mock_app/app/views/people/_first_name_form_column.html.erb +0 -2
- data/test/mock_app/app/views/people/_form.html.erb +0 -2
- data/test/mock_app/app/views/people/list.html.erb +0 -2
- data/test/mock_app/config/application.rb +0 -14
- data/test/mock_app/config/boot.rb +0 -7
- data/test/mock_app/config/database.yml +0 -16
- data/test/mock_app/config/environment.rb +0 -6
- data/test/mock_app/config/environments/development.rb +0 -24
- data/test/mock_app/config/environments/production.rb +0 -49
- data/test/mock_app/config/environments/test.rb +0 -34
- data/test/mock_app/config/initializers/backtrace_silencers.rb +0 -7
- data/test/mock_app/config/initializers/inflections.rb +0 -10
- data/test/mock_app/config/initializers/mime_types.rb +0 -5
- data/test/mock_app/config/initializers/secret_token.rb +0 -11
- data/test/mock_app/config/initializers/session_store.rb +0 -8
- data/test/mock_app/config/initializers/wrap_parameters.rb +0 -14
- data/test/mock_app/config/locales/en.yml +0 -5
- data/test/mock_app/config/routes.rb +0 -17
- data/test/mock_app/config.ru +0 -4
- data/test/mock_app/db/schema.rb +0 -68
- data/test/mock_app/db/test.sqlite3 +0 -1
- data/test/model_stub.rb +0 -64
- data/test/performance/list_cars_performance_test.rb +0 -34
- data/test/performance/list_people_performance_test.rb +0 -31
- data/test/performance_test_help.rb +0 -3
- data/test/run_all.rb +0 -6
- data/test/test_helper.rb +0 -71
- data/vendor/assets/javascripts/getprototypeof.js +0 -12
data/test/misc/tableless_test.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class TablelessTest < Minitest::Test
|
4
|
-
def test_find_all
|
5
|
-
assert FileModel.all.to_a.empty?
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_where
|
9
|
-
assert FileModel.where(name: 'file').to_a.empty?
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_where_using_assoc
|
13
|
-
assert FileModel.includes(:person).where(people: {name: 'Name'}).to_a.empty?
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_count
|
17
|
-
assert_equal 0, FileModel.count
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_find_by_id
|
21
|
-
assert_raises ActiveRecord::RecordNotFound do
|
22
|
-
FileModel.find('filename')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_find_with_association
|
27
|
-
assert Person.new.files.empty?
|
28
|
-
@person = Person.new
|
29
|
-
@person.save(validate: false)
|
30
|
-
assert !@person.files.empty?
|
31
|
-
assert @person.files.all.exists?
|
32
|
-
assert_equal @person.id, @person.files.first.person_id
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_tableless_assoc_with_dependent
|
36
|
-
@person = Person.new
|
37
|
-
@person.save(validate: false)
|
38
|
-
assert @person.destroy
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_find_with_through_association
|
42
|
-
assert Building.new.files.empty?
|
43
|
-
@building = Building.new
|
44
|
-
@building.save(validate: false)
|
45
|
-
assert @building.files.empty?
|
46
|
-
assert_equal [], @building.files.to_a
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_new
|
50
|
-
assert FileModel.new
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_association
|
54
|
-
assert FileModel.new.person.nil?
|
55
|
-
end
|
56
|
-
end
|
data/test/mock_app/.gitignore
DELETED
data/test/mock_app/Rakefile
DELETED
@@ -1,7 +0,0 @@
|
|
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.expand_path('config/application', __dir__)
|
5
|
-
require 'rake'
|
6
|
-
|
7
|
-
RailsApp::Application.load_tasks
|
File without changes
|
@@ -1,10 +0,0 @@
|
|
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
|
-
helper :all # include all helpers, all the time
|
6
|
-
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
7
|
-
|
8
|
-
# Scrub sensitive parameters from your log
|
9
|
-
# filter_parameter_logging :password
|
10
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
class Building < ActiveRecord::Base
|
2
|
-
belongs_to :owner, :class_name => 'Person', :counter_cache => true, :inverse_of => :buildings
|
3
|
-
has_many :floors, :dependent => :destroy, :inverse_of => :building
|
4
|
-
|
5
|
-
has_one :address, :as => :addressable
|
6
|
-
|
7
|
-
has_many :tenants, :through => :floors, :class_name => 'Person'
|
8
|
-
has_many :files, :through => :tenants, :class_name => 'FileModel'
|
9
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
class FileModel < ActiveScaffold::Tableless
|
2
|
-
column :name, :string
|
3
|
-
column :person_id, :integer
|
4
|
-
self.primary_key = :name
|
5
|
-
|
6
|
-
belongs_to :person
|
7
|
-
|
8
|
-
def self.find_all(relation)
|
9
|
-
relation.conditions&.each&.with_index do |condition, i|
|
10
|
-
person_id =
|
11
|
-
case condition
|
12
|
-
when Hash
|
13
|
-
condition[:person_id]
|
14
|
-
when Arel::Nodes::Equality
|
15
|
-
if condition.left.name.to_sym == :person_id
|
16
|
-
relation.bind_values[i].present? ? relation.bind_values[i][1] : condition.right.first
|
17
|
-
end
|
18
|
-
end
|
19
|
-
return [new(person_id: person_id)] if person_id
|
20
|
-
end
|
21
|
-
[]
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.find_one(id, relation)
|
25
|
-
nil
|
26
|
-
end
|
27
|
-
|
28
|
-
def destroy
|
29
|
-
true
|
30
|
-
end
|
31
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
class Floor < ActiveRecord::Base
|
2
|
-
belongs_to :building, :counter_cache => true, :inverse_of => :floors
|
3
|
-
belongs_to :tenant, :class_name => 'Person', :counter_cache => true, :inverse_of => :floor
|
4
|
-
has_one :address, :through => :building
|
5
|
-
|
6
|
-
attr_accessor :number_required
|
7
|
-
validates :number, :presence => true, :if => :number_required
|
8
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class Person < ActiveRecord::Base
|
2
|
-
has_many :buildings, :foreign_key => :owner_id, :inverse_of => :owner
|
3
|
-
has_one :floor, :foreign_key => :tenant_id, :inverse_of => :tenant
|
4
|
-
has_one :address, :through => :floor
|
5
|
-
has_one :home, :through => :floor, :source => :building, :class_name => 'Building'
|
6
|
-
|
7
|
-
has_many :contacts, :as => :contactable
|
8
|
-
has_one :car, :dependent => :destroy
|
9
|
-
has_and_belongs_to_many :roles
|
10
|
-
|
11
|
-
has_many :files, :dependent => :destroy, :class_name => 'FileModel'
|
12
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require File.expand_path('boot', __dir__)
|
2
|
-
|
3
|
-
require 'rails/all'
|
4
|
-
require 'rails/test_unit/railtie'
|
5
|
-
require 'active_scaffold'
|
6
|
-
|
7
|
-
module RailsApp
|
8
|
-
class Application < Rails::Application
|
9
|
-
config.filter_parameters << :password
|
10
|
-
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
|
11
|
-
config.i18n.enforce_available_locales = false if config.i18n.respond_to? :enforce_available_locales
|
12
|
-
config.active_record.sqlite3.represent_boolean_as_integer = true if config.active_record.sqlite3.respond_to? :represent_boolean_as_integer
|
13
|
-
end
|
14
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
-
development:
|
4
|
-
adapter: sqlite3
|
5
|
-
database: ":memory:"
|
6
|
-
pool: 5
|
7
|
-
timeout: 5000
|
8
|
-
|
9
|
-
# Warning: The database defined as "test" will be erased and
|
10
|
-
# re-generated from your development database when you run "rake".
|
11
|
-
# Do not set this db to the same as development or production.
|
12
|
-
test:
|
13
|
-
adapter: sqlite3
|
14
|
-
database: ":memory:"
|
15
|
-
pool: 5
|
16
|
-
timeout: 5000
|
@@ -1,24 +0,0 @@
|
|
1
|
-
RailsApp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/environment.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 webserver 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
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
RailsApp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
-
|
4
|
-
# The production environment is meant for finished, "live" apps.
|
5
|
-
# Code is not reloaded between requests
|
6
|
-
config.cache_classes = true
|
7
|
-
|
8
|
-
# Full error reports are disabled and caching is turned on
|
9
|
-
config.consider_all_requests_local = false
|
10
|
-
config.action_controller.perform_caching = true
|
11
|
-
|
12
|
-
# Specifies the header that your server uses for sending files
|
13
|
-
config.action_dispatch.x_sendfile_header = 'X-Sendfile'
|
14
|
-
|
15
|
-
# For nginx:
|
16
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
-
|
18
|
-
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
-
# just comment this out and Rails will serve the files
|
20
|
-
|
21
|
-
# See everything in the log (default is :info)
|
22
|
-
# config.log_level = :debug
|
23
|
-
|
24
|
-
# Use a different logger for distributed setups
|
25
|
-
# config.logger = SyslogLogger.new
|
26
|
-
|
27
|
-
# Use a different cache store in production
|
28
|
-
# config.cache_store = :mem_cache_store
|
29
|
-
|
30
|
-
# Disable Rails's static asset server
|
31
|
-
# In production, Apache or nginx will already do this
|
32
|
-
config.serve_static_assets = false
|
33
|
-
|
34
|
-
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
-
|
37
|
-
# Disable delivery errors, bad email addresses will be ignored
|
38
|
-
# config.action_mailer.raise_delivery_errors = false
|
39
|
-
|
40
|
-
# Enable threaded mode
|
41
|
-
# config.threadsafe!
|
42
|
-
|
43
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
-
# the I18n.default_locale when a translation can not be found)
|
45
|
-
config.i18n.fallbacks = true
|
46
|
-
|
47
|
-
# Send deprecation notices to registered listeners
|
48
|
-
config.active_support.deprecation = :notify
|
49
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
RailsApp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = false
|
9
|
-
config.eager_load = false
|
10
|
-
|
11
|
-
# Show full error reports and disable caching
|
12
|
-
config.consider_all_requests_local = true
|
13
|
-
config.action_controller.perform_caching = false
|
14
|
-
|
15
|
-
# Raise exceptions instead of rendering exception templates
|
16
|
-
config.action_dispatch.show_exceptions = false
|
17
|
-
|
18
|
-
# Disable request forgery protection in test environment
|
19
|
-
config.action_controller.allow_forgery_protection = false
|
20
|
-
|
21
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
22
|
-
# The :test delivery method accumulates sent emails in the
|
23
|
-
# ActionMailer::Base.deliveries array.
|
24
|
-
config.action_mailer.delivery_method = :test
|
25
|
-
|
26
|
-
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
27
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
28
|
-
# like if you have constraints or database-specific column types
|
29
|
-
# config.active_record.schema_format = :sql
|
30
|
-
|
31
|
-
# Print deprecation notices to the stderr
|
32
|
-
config.active_support.deprecation = :stderr
|
33
|
-
config.active_support.test_order = :sorted
|
34
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
-
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
-
Rails.backtrace_cleaner.remove_silencers!
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Add new inflection rules using the following format
|
4
|
-
# (all these examples are active by default):
|
5
|
-
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
-
# inflect.singular /^(ox)en/i, '\1'
|
8
|
-
# inflect.irregular 'person', 'people'
|
9
|
-
# inflect.uncountable %w( fish sheep )
|
10
|
-
# end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
# Make sure the secret is at least 30 characters and all random,
|
6
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
if RailsApp::Application.config.respond_to? :secret_key_base
|
8
|
-
RailsApp::Application.config.secret_key_base = 'e997edf9d7eba5cf89a76a046fa53f5d66261d22cfcf29e3f538c75ad2d175b106bd5d099f44f6ce34ad3b3162d71cfaa37d2d4f4b38645288331427b4c2a607'
|
9
|
-
else
|
10
|
-
RailsApp::Application.config.secret_token = 'e997edf9d7eba5cf89a76a046fa53f5d66261d22cfcf29e3f538c75ad2d175b106bd5d099f44f6ce34ad3b3162d71cfaa37d2d4f4b38645288331427b4c2a607'
|
11
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
RailsApp::Application.config.session_store :cookie_store, :key => '_test_app_session'
|
4
|
-
|
5
|
-
# Use the database for sessions instead of the cookie-based default,
|
6
|
-
# which shouldn't be used to store highly confidential information
|
7
|
-
# (create the session table with "rake db:sessions:create")
|
8
|
-
# RailsApp::Application.config.session_store :active_record_store
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
#
|
3
|
-
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
-
# is enabled by default.
|
5
|
-
|
6
|
-
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
-
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters(:format => [:json])
|
9
|
-
end
|
10
|
-
|
11
|
-
# Disable root element in JSON by default.
|
12
|
-
ActiveSupport.on_load(:active_record) do
|
13
|
-
self.include_root_in_json = false
|
14
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
Rails.application.routes.draw do
|
2
|
-
concern :active_scaffold, ActiveScaffold::Routing::Basic.new(association: true)
|
3
|
-
concern :active_scaffold_association, ActiveScaffold::Routing::Association.new
|
4
|
-
|
5
|
-
resources :addresses, concerns: :active_scaffold
|
6
|
-
resources :buildings, except: :index do
|
7
|
-
concerns :active_scaffold, except: %i[mark add_existing new_existing destroy_existing]
|
8
|
-
end
|
9
|
-
resources :cars, only: %i[index edit update] do
|
10
|
-
concerns :active_scaffold, association: false, except: [:mark]
|
11
|
-
end
|
12
|
-
resources :people do
|
13
|
-
concerns :active_scaffold, except: %i[mark]
|
14
|
-
end
|
15
|
-
|
16
|
-
match ':controller(/:action(/:id))', :via => :any
|
17
|
-
end
|
data/test/mock_app/config.ru
DELETED
data/test/mock_app/db/schema.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
# rubocop:disable Metrics/BlockLength
|
2
|
-
ActiveRecord::Schema.define do
|
3
|
-
create_table 'addresses' do |t|
|
4
|
-
t.integer 'addressable_id'
|
5
|
-
t.string 'addressable_type'
|
6
|
-
t.string 'street'
|
7
|
-
t.string 'city'
|
8
|
-
t.datetime 'created_at'
|
9
|
-
t.datetime 'updated_at'
|
10
|
-
end
|
11
|
-
|
12
|
-
create_table 'buildings' do |t|
|
13
|
-
t.string 'name'
|
14
|
-
t.integer 'owner_id'
|
15
|
-
t.integer 'floors_count', :null => false, :default => 0
|
16
|
-
t.datetime 'created_at'
|
17
|
-
t.datetime 'updated_at'
|
18
|
-
end
|
19
|
-
|
20
|
-
create_table 'cars' do |t|
|
21
|
-
t.integer 'person_id'
|
22
|
-
t.string 'brand'
|
23
|
-
t.string 'model'
|
24
|
-
t.datetime 'created_at'
|
25
|
-
t.datetime 'updated_at'
|
26
|
-
end
|
27
|
-
|
28
|
-
create_table 'contacts' do |t|
|
29
|
-
t.integer 'contactable_id'
|
30
|
-
t.string 'contactable_type'
|
31
|
-
t.string 'first_name'
|
32
|
-
t.string 'last_name'
|
33
|
-
t.date 'birthday'
|
34
|
-
t.datetime 'created_at'
|
35
|
-
t.datetime 'updated_at'
|
36
|
-
end
|
37
|
-
|
38
|
-
create_table 'floors' do |t|
|
39
|
-
t.integer 'number'
|
40
|
-
t.integer 'building_id'
|
41
|
-
t.integer 'tenant_id'
|
42
|
-
t.datetime 'created_at'
|
43
|
-
t.datetime 'updated_at'
|
44
|
-
end
|
45
|
-
|
46
|
-
create_table 'people' do |t|
|
47
|
-
t.string 'first_name'
|
48
|
-
t.string 'last_name'
|
49
|
-
t.integer 'buildings_count', :null => false, :default => 0
|
50
|
-
t.integer 'floors_count', :null => false, :default => 0
|
51
|
-
t.integer 'contacts_count', :null => false, :default => 0
|
52
|
-
t.boolean 'adult', :null => false, :default => false
|
53
|
-
t.datetime 'created_at'
|
54
|
-
t.datetime 'updated_at'
|
55
|
-
end
|
56
|
-
|
57
|
-
create_table 'roles' do |t|
|
58
|
-
t.string 'name'
|
59
|
-
t.datetime 'created_at'
|
60
|
-
t.datetime 'updated_at'
|
61
|
-
end
|
62
|
-
|
63
|
-
create_table 'people_roles', :id => false do |t|
|
64
|
-
t.integer 'person_id'
|
65
|
-
t.integer 'role_id'
|
66
|
-
end
|
67
|
-
end
|
68
|
-
# rubocop:enable Metrics/BlockLength
|
@@ -1 +0,0 @@
|
|
1
|
-
S
|
data/test/model_stub.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
class ModelStub < ActiveRecord::Base
|
2
|
-
validates :b, :presence => true
|
3
|
-
has_one :other_model, :class_name => 'ModelStub'
|
4
|
-
has_many :other_models, :class_name => 'ModelStub'
|
5
|
-
|
6
|
-
cattr_accessor :stubbed_columns
|
7
|
-
self.stubbed_columns = %i[a b c d id created_at]
|
8
|
-
attr_accessor(*stubbed_columns)
|
9
|
-
self.primary_key = :id
|
10
|
-
|
11
|
-
@@nested_scope_calls = []
|
12
|
-
cattr_accessor :nested_scope_calls
|
13
|
-
|
14
|
-
def self.a_is_defined
|
15
|
-
@@nested_scope_calls << :a_is_defined
|
16
|
-
self
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.b_like(pattern)
|
20
|
-
@@nested_scope_calls << :b_like
|
21
|
-
self
|
22
|
-
end
|
23
|
-
|
24
|
-
attr_writer :other_model
|
25
|
-
def other_model
|
26
|
-
@other_model || nil
|
27
|
-
end
|
28
|
-
|
29
|
-
attr_writer :other_models
|
30
|
-
def other_models
|
31
|
-
@other_models || []
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.columns
|
35
|
-
@columns ||= stubbed_columns.map do |c|
|
36
|
-
column = ColumnMock.new(c.to_s, '', 'varchar(255)')
|
37
|
-
column.primary = true if c.to_s == primary_key.to_s && column.respond_to?(:primary=)
|
38
|
-
column
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.columns_hash
|
43
|
-
@columns_hash ||= columns.each_with_object({}) { |column, hash| hash[column.name.to_s] = column }
|
44
|
-
end
|
45
|
-
|
46
|
-
if respond_to? :type_for_attribute
|
47
|
-
def self.type_for_attribute(attribute_name)
|
48
|
-
defined?(ActiveModel::Type) ? ActiveModel::Type::String.new : super
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# column-level security methods, used for testing
|
53
|
-
def self.a_authorized_for_bar?
|
54
|
-
true
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.b_authorized?
|
58
|
-
false
|
59
|
-
end
|
60
|
-
|
61
|
-
def self.c_authorized_for_create?
|
62
|
-
false
|
63
|
-
end
|
64
|
-
end
|