brick 1.0.96 → 1.0.98

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0061ad25b22deee43d1939b6541257924a61a67b3b8b004fb6a0072302746ca2
4
- data.tar.gz: 99968b9de834f73c60842bf5da03b5bddd750f1ff8c3ac1dac294078f0eb2358
3
+ metadata.gz: d4285ef6fb81d75bd90ceffc7d66c7fa096f04fb998da590f291f28fc9dfb45d
4
+ data.tar.gz: 2d031b156fd9c82d19af9b7818387eaecdd8cfadf939cbcf3b3b479474a77b54
5
5
  SHA512:
6
- metadata.gz: 4958e2b0c18522be75134ab29df481213594189b4addd6ef9368ae8677aba603cbb278176c57c51217a49c0042e98927cb33465995bc4aae01f3af59b2d64f15
7
- data.tar.gz: 1d486886f30ce384edc7d84a441617906b26b001c7c3562558289eedfd4b0c12e2a860c587f71acb6e6727649a3756223f1240c07f4e1013029cfe5b67a9c117
6
+ metadata.gz: 5967ede119f86cd92f88abb0f43bd2049eda4272c14ae7fa1c3f9ecc54c813c4c227be2d99aaa501363e42ef34a3eb5d0a0924ac4e540ab668e40a9a9d28311e
7
+ data.tar.gz: ab01005e485b9335c67ba48bb01a13db78fed3ce31293122fae8fbf1317b3bc0c3197adb087ec4b125e2ff7153e52fb55d8b7fc675b1e7759233cf8d42769ac7
@@ -540,7 +540,11 @@ module ActiveRecord
540
540
  tbl_name = "\"#{tbl_name}\"" if ::Brick.is_oracle && rel_dupe.brick_links.values.include?(tbl_name)
541
541
  field_tbl_name = nil
542
542
  v1.map { |x| [x[0..-2].map(&:to_s).join('.'), x.last] }.each_with_index do |sel_col, idx|
543
- field_tbl_name = rel_dupe.brick_links[sel_col.first].split('.').last
543
+ # %%% Strangely in Rails 7.1 on a slower system then very rarely brick_link comes back nil...
544
+ brick_link = rel_dupe.brick_links[sel_col.first]
545
+ field_tbl_name = brick_link&.split('.')&.last ||
546
+ # ... so here's a best-effort guess for what the table name might be.
547
+ rel_dupe.klass.reflect_on_association(sel_col.first).klass.table_name
544
548
  # If it's Oracle, quote any AREL aliases that had been applied
545
549
  field_tbl_name = "\"#{field_tbl_name}\"" if ::Brick.is_oracle && rel_dupe.brick_links.values.include?(field_tbl_name)
546
550
 
@@ -825,80 +829,9 @@ JOIN (SELECT #{hm_selects.map { |s| "#{'br_t0.' if from_clause}#{s}" }.join(', '
825
829
  end
826
830
 
827
831
  if Object.const_defined?('ActionView')
832
+ require 'brick/frameworks/rails/form_tags'
828
833
  module ActionView::Helpers::FormTagHelper
829
- def link_to_brick(*args, **kwargs)
830
- return unless ::Brick.config.mode == :on
831
-
832
- text = (args.first.is_a?(String) && args.first) || args[1]
833
- klass_or_obj = ((args.first.is_a?(ActiveRecord::Relation) ||
834
- args.first.is_a?(ActiveRecord::Base) ||
835
- args.first.is_a?(Class)) &&
836
- args.first) ||
837
- @_brick_model
838
- # If not provided, do a best-effort to automatically determine the resource class or object
839
- filter_parts = []
840
- klass_or_obj ||= begin
841
- klass, sti_type = ::Brick.ctrl_to_klass(controller_path)
842
- if klass
843
- type_col = klass.inheritance_column # Usually 'type'
844
- filter_parts << "#{type_col}=#{sti_type}" if sti_type && klass.column_names.include?(type_col)
845
- path_params = request.path_parameters.dup
846
- path_params.delete(:controller)
847
- path_params.delete(:action)
848
- pk = (klass.primary_key || ActiveRecord::Base.primary_key).to_sym
849
- # Used to also have this but it's a bit too permissive to identify a primary key: (path_params.length == 1 && path_params.values.first) ||
850
- if ((id = (path_params[pk] || path_params[:id] || path_params["#{klass.name.underscore}_id".to_sym])) && (obj = klass.find_by(pk => id))) ||
851
- (['show', 'edit', 'update', 'destroy'].include?(action_name) && (obj = klass.first))
852
- obj
853
- else
854
- # %%% If there is a HMT that refers to some ___id then try to identify an appropriate filter
855
- # %%% If there is a polymorphic association that might relate to stuff in the path_params,
856
- # try to identify an appropriate ___able_id and ___able_type filter
857
- ((klass.column_names - [pk.to_s]) & path_params.keys.map(&:to_s)).each do |path_param|
858
- filter_parts << "#{path_param}=#{path_params[path_param.to_sym]}"
859
- end
860
- klass
861
- end
862
- end
863
- rescue
864
- end
865
- if klass_or_obj
866
- if klass_or_obj.is_a?(ActiveRecord::Relation)
867
- klass_or_obj.where_values_hash.each do |whr|
868
- filter_parts << "#{whr.first}=#{whr.last}" if whr.last && !whr.last.is_a?(Array)
869
- end
870
- klass_or_obj = klass_or_obj.klass
871
- type_col = klass_or_obj.inheritance_column
872
- if klass_or_obj.column_names.include?(type_col) && klass_or_obj.name != klass_or_obj.base_class.name
873
- filter_parts << "#{type_col}=#{klass_or_obj.name}"
874
- end
875
- elsif klass_or_obj.is_a?(ActiveRecord::Base) && klass_or_obj.new_record?
876
- klass_or_obj = klass_or_obj.class
877
- end
878
- filter = "?#{filter_parts.join('&')}" if filter_parts.present?
879
- if (klass_or_obj&.is_a?(Class) && klass_or_obj < ActiveRecord::Base) ||
880
- (klass_or_obj&.is_a?(ActiveRecord::Base) && klass_or_obj.new_record? && (klass_or_obj = klass_or_obj.class))
881
- lt_args = [text || "Index for #{klass_or_obj.name.pluralize}",
882
- "#{send("#{klass_or_obj._brick_index}_path")}#{filter}"]
883
- else
884
- # If there are multiple incoming parameters then last one is probably the actual ID, and first few might be some nested tree of stuff leading up to it
885
- lt_args = [text || "Show this #{klass_or_obj.class.name}",
886
- "#{send("#{klass_or_obj.class._brick_index(:singular)}_path", klass_or_obj)}#{filter}"]
887
- end
888
- link_to(*lt_args, **kwargs)
889
- else
890
- # puts "Warning: link_to_brick could not find a class for \"#{controller_path}\" -- consider setting @_brick_model within that controller."
891
- # if (hits = res_names.keys & instance_variables.map { |v| v.to_s[1..-1] }).present?
892
- links = instance_variables.each_with_object([]) do |name, s|
893
- iv_name = name.to_s[1..-1]
894
- case (val = instance_variable_get(name))
895
- when ActiveRecord::Relation, ActiveRecord::Base
896
- s << link_to_brick(val, iv_name) if val
897
- end
898
- end
899
- links.join(' &nbsp; ').html_safe
900
- end
901
- end
834
+ include ::Brick::Rails::FormTags
902
835
  end
903
836
  end
904
837
 
@@ -1002,6 +935,7 @@ Module.class_exec do
1002
935
  end
1003
936
  class_name = ::Brick.namify(requested)
1004
937
  relations = ::Brick.relations
938
+ # CONTROLLER
1005
939
  result = if ::Brick.enable_controllers? &&
1006
940
  is_controller && (plural_class_name = class_name[0..-11]).length.positive?
1007
941
  # Otherwise now it's up to us to fill in the gaps
@@ -1020,6 +954,8 @@ Module.class_exec do
1020
954
  # if it's a controller and no match or a model doesn't really use the same table name, eager load all models and try to find a model class of the right name.
1021
955
  Object.send(:build_controller, self, class_name, plural_class_name, model, relations)
1022
956
  end
957
+
958
+ # MODULE
1023
959
  elsif (::Brick.enable_models? || ::Brick.enable_controllers?) && # Schema match?
1024
960
  base_module == Object && # %%% This works for Person::Person -- but also limits us to not being able to allow more than one level of namespacing
1025
961
  (schema_name = [(singular_table_name = class_name.underscore),
@@ -1036,6 +972,50 @@ Module.class_exec do
1036
972
 
1037
973
  [built_module, "module #{schema_name}; end\n"]
1038
974
  # # %%% Perhaps an option to use the first module just as schema, and additional modules as namespace with a table name prefix applied
975
+
976
+ # AVO Resource
977
+ elsif base_module == Object && Object.const_defined?('Avo') && requested.end_with?('Resource') &&
978
+ ['MotorResource'].exclude?(requested) # Expect that anything called MotorResource could be from that administrative gem
979
+ if (model = Object.const_get(requested[0..-9]))
980
+ require 'generators/avo/resource_generator'
981
+ field_generator = Generators::Avo::ResourceGenerator.new([''])
982
+ field_generator.instance_variable_set(:@model, model)
983
+ fields = field_generator.send(:generate_fields).split("\n")
984
+ .each_with_object([]) do |f, s|
985
+ if (f = f.strip).start_with?('field ')
986
+ f = f[6..-1].split(',')
987
+ s << [f.first[1..-1].to_sym, [f[1][1..-1].split(': :').map(&:to_sym)].to_h]
988
+ end
989
+ end
990
+ built_resource = Class.new(Avo::BaseResource) do |new_resource_class|
991
+ self.model_class = model
992
+ self.title = :brick_descrip
993
+ self.includes = []
994
+ if (!model.is_view? && mod_pk = model.primary_key)
995
+ field((mod_pk.is_a?(Array) ? mod_pk.first : mod_pk).to_sym, { as: :id })
996
+ end
997
+ # Create a call such as: field :name, as: :text
998
+ fields.each do |f|
999
+ # Add proper types if this is a polymorphic belongs_to
1000
+ if f.last == { as: :belongs_to } &&
1001
+ (fk = ::Brick.relations[model.table_name][:fks].find { |k, v| v[:assoc_name] == f.first.to_s }) &&
1002
+ fk.last.fetch(:polymorphic, nil)
1003
+ poly_types = fk.last.fetch(:inverse_table, nil)&.each_with_object([]) do |poly_table, s|
1004
+ s << Object.const_get(::Brick.relations[poly_table][:class_name])
1005
+ end
1006
+ if poly_types.present?
1007
+ f.last[:polymorphic_as] = f.first
1008
+ f.last[:types] = poly_types
1009
+ end
1010
+ end
1011
+ self.send(:field, *f)
1012
+ end
1013
+ end
1014
+ Object.const_set(requested.to_sym, built_resource)
1015
+ [built_resource, nil]
1016
+ end
1017
+
1018
+ # MODEL
1039
1019
  elsif ::Brick.enable_models?
1040
1020
  # Custom inheritable Brick base model?
1041
1021
  class_name = (inheritable_name = class_name)[5..-1] if class_name.start_with?('Brick')
@@ -1397,14 +1377,19 @@ class Object
1397
1377
  end
1398
1378
 
1399
1379
  def build_controller(namespace, class_name, plural_class_name, model, relations)
1380
+ if (is_avo = (namespace.name == 'Avo' && Object.const_defined?('Avo')))
1381
+ # Basic Avo functionality is available via its own generic controller.
1382
+ # (More information on https://docs.avohq.io/2.0/controllers.html)
1383
+ controller_base = Avo::ResourcesController
1384
+ end
1400
1385
  table_name = ActiveSupport::Inflector.underscore(plural_class_name)
1401
1386
  singular_table_name = ActiveSupport::Inflector.singularize(table_name)
1402
1387
  pk = model&._brick_primary_key(relations.fetch(table_name, nil))
1403
1388
  is_postgres = ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
1404
1389
  is_mysql = ActiveRecord::Base.connection.adapter_name == 'Mysql2'
1405
1390
 
1406
- code = +"class #{class_name} < ApplicationController\n"
1407
- built_controller = Class.new(ActionController::Base) do |new_controller_class|
1391
+ code = +"class #{class_name} < #{controller_base&.name || 'ApplicationController'}\n"
1392
+ built_controller = Class.new(controller_base || ActionController::Base) do |new_controller_class|
1408
1393
  (namespace || Object).const_set(class_name.to_sym, new_controller_class)
1409
1394
 
1410
1395
  # Brick-specific pages
@@ -1501,118 +1486,120 @@ class Object
1501
1486
  end
1502
1487
 
1503
1488
  self.protect_from_forgery unless: -> { self.request.format.js? }
1504
- self.define_method :index do
1505
- if (is_openapi || request.env['REQUEST_PATH'].start_with?(::Brick.api_root)) &&
1506
- !params&.key?('_brick_schema') &&
1507
- (referrer_params = request.env['HTTP_REFERER']&.split('?')&.last&.split('&')&.map { |x| x.split('=') }).present?
1508
- if params
1509
- referrer_params.each { |k, v| params.send(:parameters)[k] = v }
1510
- else
1511
- api_params = referrer_params&.to_h
1489
+ unless is_avo
1490
+ self.define_method :index do
1491
+ if (is_openapi || request.env['REQUEST_PATH'].start_with?(::Brick.api_root)) &&
1492
+ !params&.key?('_brick_schema') &&
1493
+ (referrer_params = request.env['HTTP_REFERER']&.split('?')&.last&.split('&')&.map { |x| x.split('=') }).present?
1494
+ if params
1495
+ referrer_params.each { |k, v| params.send(:parameters)[k] = v }
1496
+ else
1497
+ api_params = referrer_params&.to_h
1498
+ end
1512
1499
  end
1513
- end
1514
- _schema, @_is_show_schema_list = ::Brick.set_db_schema(params || api_params)
1515
-
1516
- if is_openapi
1517
- json = { 'openapi': '3.0.1', 'info': { 'title': Rswag::Ui.config.config_object[:urls].last&.fetch(:name, 'API documentation'), 'version': ::Brick.config.api_version },
1518
- 'servers': [
1519
- { 'url': '{scheme}://{defaultHost}', 'variables': {
1520
- 'scheme': { 'default': request.env['rack.url_scheme'] },
1521
- 'defaultHost': { 'default': request.env['HTTP_HOST'] }
1522
- } }
1523
- ]
1524
- }
1525
- json['paths'] = relations.inject({}) do |s, relation|
1526
- unless ::Brick.config.enable_api == false
1527
- table_description = relation.last[:description]
1528
- s["#{::Brick.config.api_root}#{relation.first.tr('.', '/')}"] = {
1529
- 'get': {
1530
- 'summary': "list #{relation.first}",
1531
- 'description': table_description,
1532
- 'parameters': relation.last[:cols].map do |k, v|
1533
- param = { 'name' => k, 'schema': { 'type': v.first } }
1534
- if (col_descrip = relation.last.fetch(:col_descrips, nil)&.fetch(k, nil))
1535
- param['description'] = col_descrip
1536
- end
1537
- param
1538
- end,
1539
- 'responses': { '200': { 'description': 'successful' } }
1540
- }
1541
- }
1542
-
1543
- s["#{::Brick.config.api_root}#{relation.first.tr('.', '/')}/{id}"] = {
1544
- 'patch': {
1545
- 'summary': "update a #{relation.first.singularize}",
1546
- 'description': table_description,
1547
- 'parameters': relation.last[:cols].reject { |k, v| Brick.config.metadata_columns.include?(k) }.map do |k, v|
1548
- param = { 'name' => k, 'schema': { 'type': v.first } }
1549
- if (col_descrip = relation.last.fetch(:col_descrips, nil)&.fetch(k, nil))
1550
- param['description'] = col_descrip
1551
- end
1552
- param
1553
- end,
1554
- 'responses': { '200': { 'description': 'successful' } }
1500
+ _schema, @_is_show_schema_list = ::Brick.set_db_schema(params || api_params)
1501
+
1502
+ if is_openapi
1503
+ json = { 'openapi': '3.0.1', 'info': { 'title': Rswag::Ui.config.config_object[:urls].last&.fetch(:name, 'API documentation'), 'version': ::Brick.config.api_version },
1504
+ 'servers': [
1505
+ { 'url': '{scheme}://{defaultHost}', 'variables': {
1506
+ 'scheme': { 'default': request.env['rack.url_scheme'] },
1507
+ 'defaultHost': { 'default': request.env['HTTP_HOST'] }
1508
+ } }
1509
+ ]
1510
+ }
1511
+ json['paths'] = relations.inject({}) do |s, relation|
1512
+ unless ::Brick.config.enable_api == false
1513
+ table_description = relation.last[:description]
1514
+ s["#{::Brick.config.api_root}#{relation.first.tr('.', '/')}"] = {
1515
+ 'get': {
1516
+ 'summary': "list #{relation.first}",
1517
+ 'description': table_description,
1518
+ 'parameters': relation.last[:cols].map do |k, v|
1519
+ param = { 'name' => k, 'schema': { 'type': v.first } }
1520
+ if (col_descrip = relation.last.fetch(:col_descrips, nil)&.fetch(k, nil))
1521
+ param['description'] = col_descrip
1522
+ end
1523
+ param
1524
+ end,
1525
+ 'responses': { '200': { 'description': 'successful' } }
1526
+ }
1555
1527
  }
1556
- } unless relation.last.fetch(:isView, nil)
1557
- s
1528
+
1529
+ s["#{::Brick.config.api_root}#{relation.first.tr('.', '/')}/{id}"] = {
1530
+ 'patch': {
1531
+ 'summary': "update a #{relation.first.singularize}",
1532
+ 'description': table_description,
1533
+ 'parameters': relation.last[:cols].reject { |k, v| Brick.config.metadata_columns.include?(k) }.map do |k, v|
1534
+ param = { 'name' => k, 'schema': { 'type': v.first } }
1535
+ if (col_descrip = relation.last.fetch(:col_descrips, nil)&.fetch(k, nil))
1536
+ param['description'] = col_descrip
1537
+ end
1538
+ param
1539
+ end,
1540
+ 'responses': { '200': { 'description': 'successful' } }
1541
+ }
1542
+ } unless relation.last.fetch(:isView, nil)
1543
+ s
1544
+ end
1558
1545
  end
1546
+ render inline: json.to_json, content_type: request.format
1547
+ return
1559
1548
  end
1560
- render inline: json.to_json, content_type: request.format
1561
- return
1562
- end
1563
1549
 
1564
- if request.format == :csv # Asking for a template?
1565
- require 'csv'
1566
- exported_csv = CSV.generate(force_quotes: false) do |csv_out|
1567
- model.df_export(model.brick_import_template).each { |row| csv_out << row }
1550
+ if request.format == :csv # Asking for a template?
1551
+ require 'csv'
1552
+ exported_csv = CSV.generate(force_quotes: false) do |csv_out|
1553
+ model.df_export(model.brick_import_template).each { |row| csv_out << row }
1554
+ end
1555
+ render inline: exported_csv, content_type: request.format
1556
+ return
1557
+ elsif request.format == :js || request.path.start_with?('/api/') # Asking for JSON?
1558
+ data = (model.is_view? || !Object.const_defined?('DutyFree')) ? model.limit(1000) : model.df_export(model.brick_import_template)
1559
+ render inline: data.to_json, content_type: request.format == '*/*' ? 'application/json' : request.format
1560
+ return
1568
1561
  end
1569
- render inline: exported_csv, content_type: request.format
1570
- return
1571
- elsif request.format == :js || request.path.start_with?('/api/') # Asking for JSON?
1572
- data = (model.is_view? || !Object.const_defined?('DutyFree')) ? model.limit(1000) : model.df_export(model.brick_import_template)
1573
- render inline: data.to_json, content_type: request.format == '*/*' ? 'application/json' : request.format
1574
- return
1575
- end
1576
1562
 
1577
- # Normal (not swagger or CSV) request
1578
-
1579
- # %%% Allow params to define which columns to use for order_by
1580
- # Overriding the default by providing a querystring param?
1581
- ordering = params['_brick_order']&.split(',')&.map(&:to_sym) || Object.send(:default_ordering, table_name, pk)
1582
- order_by, _ = model._brick_calculate_ordering(ordering, true) # Don't do the txt part
1583
-
1584
- ar_relation = ActiveRecord.version < Gem::Version.new('4') ? model.preload : model.all
1585
- @_brick_params = ar_relation.brick_select(params, (selects = []), order_by,
1586
- translations = {},
1587
- join_array = ::Brick::JoinArray.new)
1588
- # %%% Add custom HM count columns
1589
- # %%% What happens when the PK is composite?
1590
- counts = model._br_hm_counts.each_with_object([]) do |v, s|
1591
- s << if is_mysql
1592
- "`b_r_#{v.first}`.c_t_ AS \"b_r_#{v.first}_ct\""
1593
- elsif is_postgres
1594
- "\"b_r_#{v.first}\".c_t_ AS \"b_r_#{v.first}_ct\""
1595
- else
1596
- "b_r_#{v.first}.c_t_ AS \"b_r_#{v.first}_ct\""
1597
- end
1598
- end
1599
- ar_select = ar_relation.respond_to?(:_select!) ? ar_relation.dup._select!(*selects, *counts) : ar_relation.select(selects + counts)
1600
- instance_variable_set("@#{table_name.pluralize}".to_sym, ar_select)
1601
- if namespace && (idx = lookup_context.prefixes.index(table_name))
1602
- lookup_context.prefixes[idx] = "#{namespace.name.underscore}/#{lookup_context.prefixes[idx]}"
1603
- end
1604
- @_brick_excl = session[:_brick_exclude]&.split(',')&.each_with_object([]) do |excl, s|
1605
- if (excl_parts = excl.split('.')).first == table_name
1606
- s << excl_parts.last
1563
+ # Normal (not swagger or CSV) request
1564
+
1565
+ # %%% Allow params to define which columns to use for order_by
1566
+ # Overriding the default by providing a querystring param?
1567
+ ordering = params['_brick_order']&.split(',')&.map(&:to_sym) || Object.send(:default_ordering, table_name, pk)
1568
+ order_by, _ = model._brick_calculate_ordering(ordering, true) # Don't do the txt part
1569
+
1570
+ ar_relation = ActiveRecord.version < Gem::Version.new('4') ? model.preload : model.all
1571
+ @_brick_params = ar_relation.brick_select(params, (selects = []), order_by,
1572
+ translations = {},
1573
+ join_array = ::Brick::JoinArray.new)
1574
+ # %%% Add custom HM count columns
1575
+ # %%% What happens when the PK is composite?
1576
+ counts = model._br_hm_counts.each_with_object([]) do |v, s|
1577
+ s << if is_mysql
1578
+ "`b_r_#{v.first}`.c_t_ AS \"b_r_#{v.first}_ct\""
1579
+ elsif is_postgres
1580
+ "\"b_r_#{v.first}\".c_t_ AS \"b_r_#{v.first}_ct\""
1581
+ else
1582
+ "b_r_#{v.first}.c_t_ AS \"b_r_#{v.first}_ct\""
1583
+ end
1584
+ end
1585
+ ar_select = ar_relation.respond_to?(:_select!) ? ar_relation.dup._select!(*selects, *counts) : ar_relation.select(selects + counts)
1586
+ instance_variable_set("@#{table_name.pluralize}".to_sym, ar_select)
1587
+ if namespace && (idx = lookup_context.prefixes.index(table_name))
1588
+ lookup_context.prefixes[idx] = "#{namespace.name.underscore}/#{lookup_context.prefixes[idx]}"
1589
+ end
1590
+ @_brick_excl = session[:_brick_exclude]&.split(',')&.each_with_object([]) do |excl, s|
1591
+ if (excl_parts = excl.split('.')).first == table_name
1592
+ s << excl_parts.last
1593
+ end
1607
1594
  end
1608
- end
1609
- @_brick_bt_descrip = model._br_bt_descrip
1610
- @_brick_hm_counts = model._br_hm_counts
1611
- @_brick_join_array = join_array
1612
- @_brick_erd = params['_brick_erd']&.to_i
1595
+ @_brick_bt_descrip = model._br_bt_descrip
1596
+ @_brick_hm_counts = model._br_hm_counts
1597
+ @_brick_join_array = join_array
1598
+ @_brick_erd = params['_brick_erd']&.to_i
1599
+ end
1613
1600
  end
1614
1601
 
1615
- unless is_openapi
1602
+ unless is_openapi || is_avo
1616
1603
  _, order_by_txt = model._brick_calculate_ordering(default_ordering(table_name, pk)) if pk
1617
1604
  code << " def index\n"
1618
1605
  code << " @#{table_name.pluralize} = #{model.name}#{pk&.present? ? ".order(#{order_by_txt.join(', ')})" : '.all'}\n"
@@ -3,7 +3,7 @@
3
3
  module Brick
4
4
  module Rails
5
5
  # Extensions to rails controllers. Provides convenient ways to pass certain
6
- # information to the model layer, with `controller_info` and `whodunnit`.
6
+ # information to the model layer, with `controller_info`.
7
7
  # Also includes a convenient on/off switch,
8
8
  # `brick_enabled_for_controller`.
9
9
  module Controller