ez 1.3.0 → 1.5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +8 -14
  4. data/lib/ez.rb +11 -17
  5. data/lib/ez/domain_modeler.rb +6 -2
  6. data/lib/ez/model.rb +1 -11
  7. data/lib/ez/schema_modifier.rb +25 -15
  8. data/lib/ez/version.rb +1 -1
  9. data/lib/tasks/ez_tasks.rake +2 -2
  10. metadata +4 -39
  11. data/lib/ez/apis.rb +0 -26
  12. data/lib/ez/controller.rb +0 -19
  13. data/lib/ez/dispatcher.rb +0 -28
  14. data/lib/ez/mapper.rb +0 -22
  15. data/lib/ez/view_helpers.rb +0 -18
  16. data/lib/generators/ez/resource/USAGE +0 -35
  17. data/lib/generators/ez/resource/migration.rb +0 -15
  18. data/lib/generators/ez/resource/resource_generator.rb +0 -143
  19. data/lib/generators/ez/resource/templates/bootstrapped/edit.html.erb +0 -26
  20. data/lib/generators/ez/resource/templates/bootstrapped/index.html.erb +0 -42
  21. data/lib/generators/ez/resource/templates/bootstrapped/new.html.erb +0 -26
  22. data/lib/generators/ez/resource/templates/bootstrapped/show.html.erb +0 -11
  23. data/lib/generators/ez/resource/templates/controller.rb +0 -70
  24. data/lib/generators/ez/resource/templates/dried/_form.html.erb +0 -13
  25. data/lib/generators/ez/resource/templates/dried/bootstrapped/_form.html.erb +0 -21
  26. data/lib/generators/ez/resource/templates/dried/bootstrapped/edit.html.erb +0 -5
  27. data/lib/generators/ez/resource/templates/dried/bootstrapped/index.html.erb +0 -42
  28. data/lib/generators/ez/resource/templates/dried/bootstrapped/new.html.erb +0 -5
  29. data/lib/generators/ez/resource/templates/dried/bootstrapped/show.html.erb +0 -11
  30. data/lib/generators/ez/resource/templates/dried/controller.rb +0 -72
  31. data/lib/generators/ez/resource/templates/dried/edit.html.erb +0 -3
  32. data/lib/generators/ez/resource/templates/dried/index.html.erb +0 -40
  33. data/lib/generators/ez/resource/templates/dried/new.html.erb +0 -3
  34. data/lib/generators/ez/resource/templates/dried/show.html.erb +0 -9
  35. data/lib/generators/ez/resource/templates/edit.html.erb +0 -24
  36. data/lib/generators/ez/resource/templates/index.html.erb +0 -40
  37. data/lib/generators/ez/resource/templates/migration.rb +0 -15
  38. data/lib/generators/ez/resource/templates/model.rb +0 -2
  39. data/lib/generators/ez/resource/templates/new.html.erb +0 -22
  40. data/lib/generators/ez/resource/templates/show.html.erb +0 -9
  41. data/lib/generators/ez/style/USAGE +0 -31
  42. data/lib/generators/ez/style/style_generator.rb +0 -34
  43. data/lib/generators/ez/style/templates/layout.html.erb +0 -66
  44. data/lib/generators/ez/user/templates/user_controller.rb +0 -68
  45. data/lib/generators/ez/user/user_generator.rb +0 -91
  46. data/lib/generators/ez/views/USAGE +0 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 651da5699fe33ae98d63db37c12d5d75e30fdc68
4
- data.tar.gz: 1b3d7f79c58140be5a7c1a9403b47d930b3837cb
3
+ metadata.gz: 1489c438d97d79208d963c25252fded0a1abaf9e
4
+ data.tar.gz: 784a7645ba2e2a63bc37942b9dbeb6eba536a857
5
5
  SHA512:
6
- metadata.gz: d481867135942e93bd1deadca16ccb1c6400ebb5c03adaeedfac3341bcf2354e40a205c4b238fff6aa069454169712b0b74185cb3fc71fe6df5910ef1fa68f0f
7
- data.tar.gz: 596950b0f26338731f1d02fc3284b03a397375567ae9dcf80a8a05834adf6ac6d72f47e8036bd38d47bfde73b86895af5a2c1c9b1186b5b239c9ca30de3ed7d8
6
+ metadata.gz: ae85e1d114644062bcf66924b8d231bce256dc9782cd9b11d96aa81cf470e69d1c6ba7cb1cec963f18ecf170b5873ce12898873a2c964166147e17616b029a06
7
+ data.tar.gz: 6dab9bc2e6bf81859a2d7e3eef8f8696141405a045826f81b739686ea7df4aabeb5763917820b463ee59ca6b1ae6113385249f2e901b9e8e98fdad30dee900e2
@@ -0,0 +1,8 @@
1
+ *Version 1.5.0.2*
2
+
3
+ - Rails 5 compatibility
4
+ - Column deletion, model deletion, and column renaming applied in dev and test environments only
5
+ - Warning! Column type changes are allowed in ALL environments.
6
+ - Starting the console no longer evaluates `models.yml` file. You must run `reload!` to apply any changes.
7
+ - Focused on domain modeling only. Removed old controller filters, generators, and view helpers.
8
+ - Removed dead code.
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # EZ
2
2
 
3
- **Version 1.3.0**
3
+ **Version 1.5.0.2**
4
4
 
5
5
  *For educational purposes only.*
6
6
 
7
+ Tested against Rails 5.0.2 and Rails 4.2.6.
8
+
7
9
  Easy domain modeling in Rails without migrations. Applies instant schema changes based on a file named `db/models.yml`. Diffs are determined automatically and applied to the database. Embraces Rails column naming conventions by providing happy-path default types for most columns.
8
10
 
9
11
  Also, enhances the rails console and provides extra ActiveRecord helper methods.
@@ -40,10 +42,10 @@ to generate a skeleton `db/models.yml` that you should edit.
40
42
  ### 1. Domain Modeling Enhancements
41
43
 
42
44
  * This gem enhances `db:migrate` to incorporate the `db/models.yml` file automatically.
43
- * Run `rake db:migrate` to initially generate a file named `db/models.yml`. It will have some self-documenting comments inside of it.
44
- * Just run `rake db:migrate` whenever you modify `db/models.yml`.
45
- * Starting the rails console will automatically run any pending table updates, and `reload!` will also trigger table updates while inside the console.
46
- * `rake db:migrate` will run any pending migrations *after* any table updates from the `db/models.yml` file.
45
+ * Run `rails db:migrate` (Rails 5.x) or `rake db:migrate` (Rails 4.x) to initially generate a file named `db/models.yml`. It will have some self-documenting comments inside of it.
46
+ * Just run `rails db:migrate` (or `rake db:migrate`) whenever you modify `db/models.yml`.
47
+ * Using `reload!` inside the rails console is an alternative to the `db:migrate` task.
48
+ * Pending migrations will be run *after* running table updates based on the `db/models.yml` file.
47
49
 
48
50
 
49
51
  **Syntax Guide for `db/models.yml`**
@@ -160,16 +162,8 @@ Author
160
162
 
161
163
  ### 3. Beginner-friendly "It Just Works" console
162
164
 
163
- * Starting `rails console` will automatically apply any pending database changes, followed by any traditional migrations.
164
165
  * Solves the "no connection" message in Rails >= 4.0.1 (if you try to inspect a model without making a query first) by establishing an initial connection to the development database.
165
166
  * Shows helpful instructions when console starts, including the list of model classes found in the application.
166
167
  * Uses Hirb for table-like display. (Requires Hirb ~> 0.7.1)
167
168
  * Patches Hirb to allow nice table output for `ActiveRecord::Relation` lists (i.e. result of `.all`, `.where`) and hash-like output for single ActiveRecord objects, such as the result of `.find_by(:title => 'Apollo 13')`.
168
- * `reload!` will also force a schema update from the console.
169
-
170
-
171
- ### 4. Controller and View Enhancements
172
-
173
- * Easier JSON API calls by calling `EZ.from_api(url)`; returns parsed Ruby hash (or array, etc.)
174
- * Built-in view helper `<%= weather %>` and `EZ.weather` for classroom demo of a JSON API, to get quick hash and avoid gory details. (Relies on http://openweathermap.org). Default location is Evanston. Can pass location: `<%= weather('San Diego, CA') %>`. The `<%= weather %>` helper just delegates to `EZ.weather`.
175
- * Adds view helper `map` to display a static Google map of any address. Example: `<%= map('Millenium Park, Chicago, IL') %>`
169
+ * `reload!` will force a schema update from the console.
data/lib/ez.rb CHANGED
@@ -1,21 +1,19 @@
1
1
  require "ez/version"
2
- # require 'ez/dispatcher.rb'
3
- # require 'ez/mapper.rb'
4
- require 'ez/controller.rb'
5
-
6
- require 'ez/apis.rb'
7
2
  require 'ez/domain_modeler.rb'
8
3
  require 'ez/model.rb'
9
- require 'ez/view_helpers.rb'
10
4
 
11
- require 'hirb' if Rails.env.development?
5
+ require 'hirb' if (Rails.env.development? || Rails.env.test?)
12
6
 
13
7
  module EZ
14
8
  module Console
15
- def reload!(print=true)
9
+ def reload!(print = true)
16
10
  puts "Reloading code..." if print
17
- ActionDispatch::Reloader.cleanup!
18
- ActionDispatch::Reloader.prepare!
11
+ if Rails::VERSION::MAJOR < 5
12
+ ActionDispatch::Reloader.cleanup!
13
+ ActionDispatch::Reloader.prepare!
14
+ else
15
+ Rails.application.reloader.reload!
16
+ end
19
17
 
20
18
  puts "Updating tables (if necessary) ..." if print
21
19
  old_level = ActiveRecord::Base.logger.level
@@ -40,7 +38,7 @@ module EZ
40
38
 
41
39
  console do |app|
42
40
  Rails::ConsoleMethods.send :prepend, EZ::Console
43
- Hirb.enable(pager: false) if ::Rails.env.development? && defined?(Hirb)
41
+ Hirb.enable(pager: false) if ::(Rails.env.development? || Rails.env.test?) && defined?(Hirb)
44
42
 
45
43
  old_level = ActiveRecord::Base.logger.level
46
44
  ActiveRecord::Base.logger.level = Logger::WARN
@@ -70,11 +68,7 @@ module EZ
70
68
 
71
69
  initializer "ez" do
72
70
 
73
- ActiveSupport.on_load :action_view do
74
- include EZ::ViewHelpers
75
- end
76
-
77
- # tables = ActiveRecord::Base.connection.tables - ['schema_migrations']
71
+ # tables = ActiveRecord::Base.connection.data_sources - ['schema_migrations', 'ar_internal_metadata']
78
72
  # models.each { |m| m.constantize.magic_associations }
79
73
  # Rails.application.routes.draw do
80
74
  # tables.each do |table_name|
@@ -82,7 +76,7 @@ module EZ
82
76
  # end
83
77
  # end
84
78
 
85
- if Rails.env.development?
79
+ if (Rails.env.development? || Rails.env.test?)
86
80
  module ::Hirb
87
81
  # A Formatter object formats an output object (using Formatter.format_output) into a string based on the views defined
88
82
  # for its class and/or ancestry.
@@ -1,6 +1,9 @@
1
1
  require_relative 'schema_modifier'
2
2
 
3
3
  module EZ
4
+
5
+ COLUMN_TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE']
6
+
4
7
  # The DomainModeler class implements the db/models.yml file syntax
5
8
  # and provides a hash of the domain model specification.
6
9
 
@@ -10,7 +13,7 @@ module EZ
10
13
  DEFAULT_VALUE_REGEXES = [/\s*\((.+)?\)/, /\s+(.+)?\s*/, /,\s*default:\s*(.+)?\s*/]
11
14
 
12
15
  def self.models
13
- tables = ActiveRecord::Base.connection.tables - ['schema_migrations']
16
+ tables = ActiveRecord::Base.connection.data_sources - ['schema_migrations', 'ar_internal_metadata']
14
17
  tables.map { |t| t.classify }
15
18
  end
16
19
 
@@ -50,6 +53,7 @@ module EZ
50
53
  #
51
54
  # Default column values can be specified like this:
52
55
  # price: integer(0)
56
+ # hardcover: boolean(false)
53
57
  #
54
58
  # Have fun!
55
59
 
@@ -146,7 +150,7 @@ module EZ
146
150
  default_column_value = default_column_value.to_f if default_column_value.present? && column_type == 'float'
147
151
 
148
152
  if column_type == 'boolean'
149
- default_column_value = default_column_value.present? && default_column_value.downcase.strip == 'true'
153
+ default_column_value = default_column_value.present? && default_column_value.in?(EZ::COLUMN_TRUE_VALUES)
150
154
  end
151
155
 
152
156
  @spec[model][column_name] = { type: column_type, default: default_column_value}
@@ -1,15 +1,5 @@
1
1
  class ActiveRecord::Base
2
2
 
3
- def self.magic_associations
4
- x = self.column_names.select { |n| n.ends_with? '_id' }
5
-
6
- x.each do |fk|
7
- assoc_name = fk[0, fk.length - 3]
8
- belongs_to assoc_name.to_sym
9
- assoc_name.classify.constantize.send(:has_many, self.name.underscore.pluralize.to_sym, dependent: :destroy)
10
- end
11
- end
12
-
13
3
  def inspect
14
4
  "#<#{self.class.name} #{attributes}>"
15
5
  end
@@ -45,7 +35,7 @@ class ActiveRecord::Base
45
35
  end
46
36
 
47
37
  def self.dump_tables_to_ez
48
- (connection.tables - ['schema_migrations']).each do |table|
38
+ (connection.data_sources - ['schema_migrations', 'ar_internal_metadata']).each do |table|
49
39
  puts table.classify.constantize.to_ez
50
40
  end
51
41
  end
@@ -47,7 +47,7 @@ module EZ
47
47
 
48
48
 
49
49
  def tables
50
- @tables ||= (db.tables - ['schema_migrations'])
50
+ @tables ||= (db.data_sources - ['schema_migrations', 'ar_internal_metadata'])
51
51
  end
52
52
 
53
53
  def missing_model?(model_name)
@@ -73,54 +73,58 @@ module EZ
73
73
  @changed = true
74
74
  end
75
75
 
76
- def add_missing_columns(model_name, columns, assume_missing = false)
76
+ def add_missing_columns(model_name, spec_columns, assume_missing = false)
77
77
  table_name = model_name.tableize
78
78
  db_columns = db.columns(table_name)
79
79
 
80
- columns.each do |col_name, data|
81
- col_type = data[:type].to_sym
82
- col_default = data[:default]
80
+ spec_columns.each do |col_name, col_spec|
81
+ col_type = col_spec[:type].to_sym
82
+ col_default = col_spec[:default]
83
83
  db_col = !assume_missing && (db_columns.detect { |dbc| dbc.name == col_name })
84
84
 
85
85
  if !db_col
86
86
  if !assume_missing
87
- display_change "Adding new column '#{col_name}' as #{col_type} for model #{model_name}"
87
+ display_change "Adding new column '#{col_name}' as #{col_type} in model #{model_name}"
88
88
  end
89
89
  opts = { default: col_default }
90
- opts[:limit] = data[:limit] if data[:limit]
90
+ opts[:limit] = col_spec[:limit] if col_spec[:limit]
91
91
  db.add_column(table_name, col_name.to_sym, col_type.to_sym, opts) unless @dry_run
92
- if data[:index]
92
+ if col_spec[:index]
93
93
  display_change " (adding database index for '#{col_name}')"
94
94
  db.add_index table_name, col_name.to_sym unless @dry_run
95
95
  end
96
96
  else
97
97
  if db_col.type != col_type
98
- display_change "Changing column type for #{col_name} to #{col_type} for model #{model_name}"
98
+ display_change "Changing column type for #{col_name} to #{col_type} in model #{model_name}"
99
99
  end
100
100
 
101
101
  # puts "#{table_name} #{col_name}: #{db_col.default} and #{col_default}"
102
- if db_col.default != col_default
102
+ if col_type == :boolean
103
+ db_col_default = db_col.default.in?(EZ::COLUMN_TRUE_VALUES)
104
+ end
105
+
106
+ if db_col_default != col_default
103
107
  displayable_value = col_default
104
108
  displayable_value = "NULL" if col_default.nil?
105
- display_change "Applying new default value #{displayable_value} for #{col_name} for model #{model_name}"
109
+ display_change "Applying new default value `#{displayable_value}` for #{col_name} attrbute in model #{model_name}"
106
110
  end
107
111
 
108
112
  if (db_col.type != col_type) || (db_col.default != col_default)
109
113
  opts = { default: col_default }
110
- opts[:limit] = data[:limit] if data[:limit]
114
+ opts[:limit] = col_spec[:limit] if col_spec[:limit]
111
115
  db.change_column(table_name, col_name.to_sym, col_type.to_sym, opts) unless @dry_run
112
116
  end
113
117
  end
114
118
  end
115
119
  end
116
120
 
117
- def add_model(model_name, columns)
121
+ def add_model(model_name, spec_columns)
118
122
  table_name = model_name.tableize
119
123
  display_change "Defining new table for model '#{model_name}'."
120
124
  db.create_table table_name unless @dry_run
121
- add_missing_columns model_name, columns, true
125
+ add_missing_columns model_name, spec_columns, true
122
126
  filename = "app/models/#{model_name.underscore}.rb"
123
- unless Rails.env.production? || File.exists?(filename)
127
+ if (Rails.env.development? || Rails.env.test?) && !File.exists?(filename)
124
128
  display_change "Creating new model file: #{filename}"
125
129
  File.open(filename, "w") do |f|
126
130
  f.puts "class #{model_name} < ActiveRecord::Base"
@@ -130,11 +134,15 @@ module EZ
130
134
  end
131
135
 
132
136
  def remove_dead_schema
137
+ return unless Rails.env.development? || Rails.env.test?
138
+
133
139
  remove_dead_tables
134
140
  remove_dead_columns
135
141
  end
136
142
 
137
143
  def remove_dead_columns
144
+ return unless Rails.env.development? || Rails.env.test?
145
+
138
146
  tables.each do |table_name|
139
147
  model_name = table_name.classify.to_s
140
148
 
@@ -161,6 +169,8 @@ module EZ
161
169
  end
162
170
 
163
171
  def remove_dead_tables
172
+ return unless Rails.env.development? || Rails.env.test?
173
+
164
174
  tables_we_need = @spec.keys.map { |model| model.tableize }
165
175
  dead_tables = tables - tables_we_need
166
176
 
@@ -1,3 +1,3 @@
1
1
  module EZ
2
- VERSION = "1.3.0"
2
+ VERSION = "1.5.0.2"
3
3
  end
@@ -35,7 +35,7 @@ namespace :ez do
35
35
  # Typical column choices are: string, text, integer, boolean, date, time, and datetime.
36
36
  #
37
37
  #
38
- # Specifying Default Values
38
+ # About Default Values
39
39
  # ----------------------------------------------------
40
40
  # Default column values can be specified like this:
41
41
  # price: integer(0)
@@ -73,7 +73,7 @@ EOS
73
73
  task :tables => [:environment] do
74
74
  if File.exists?('db/models.yml')
75
75
  if EZ::DomainModeler.update_tables
76
- Rake::Task["db:schema:dump"].invoke unless Rails.env.production?
76
+ Rake::Task["db:schema:dump"].invoke if (Rails.env.development? || Rails.env.test?)
77
77
  end
78
78
  else
79
79
  Rake::Task["ez:generate_yml"].invoke
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ez
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.5.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Cohen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-13 00:00:00.000000000 Z
11
+ date: 2017-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hirb
@@ -66,52 +66,17 @@ extensions: []
66
66
  extra_rdoc_files: []
67
67
  files:
68
68
  - ".gitignore"
69
+ - CHANGELOG.md
69
70
  - Gemfile
70
71
  - LICENSE.txt
71
72
  - README.md
72
73
  - Rakefile
73
74
  - ez.gemspec
74
75
  - lib/ez.rb
75
- - lib/ez/apis.rb
76
- - lib/ez/controller.rb
77
- - lib/ez/dispatcher.rb
78
76
  - lib/ez/domain_modeler.rb
79
- - lib/ez/mapper.rb
80
77
  - lib/ez/model.rb
81
78
  - lib/ez/schema_modifier.rb
82
79
  - lib/ez/version.rb
83
- - lib/ez/view_helpers.rb
84
- - lib/generators/ez/resource/USAGE
85
- - lib/generators/ez/resource/migration.rb
86
- - lib/generators/ez/resource/resource_generator.rb
87
- - lib/generators/ez/resource/templates/bootstrapped/edit.html.erb
88
- - lib/generators/ez/resource/templates/bootstrapped/index.html.erb
89
- - lib/generators/ez/resource/templates/bootstrapped/new.html.erb
90
- - lib/generators/ez/resource/templates/bootstrapped/show.html.erb
91
- - lib/generators/ez/resource/templates/controller.rb
92
- - lib/generators/ez/resource/templates/dried/_form.html.erb
93
- - lib/generators/ez/resource/templates/dried/bootstrapped/_form.html.erb
94
- - lib/generators/ez/resource/templates/dried/bootstrapped/edit.html.erb
95
- - lib/generators/ez/resource/templates/dried/bootstrapped/index.html.erb
96
- - lib/generators/ez/resource/templates/dried/bootstrapped/new.html.erb
97
- - lib/generators/ez/resource/templates/dried/bootstrapped/show.html.erb
98
- - lib/generators/ez/resource/templates/dried/controller.rb
99
- - lib/generators/ez/resource/templates/dried/edit.html.erb
100
- - lib/generators/ez/resource/templates/dried/index.html.erb
101
- - lib/generators/ez/resource/templates/dried/new.html.erb
102
- - lib/generators/ez/resource/templates/dried/show.html.erb
103
- - lib/generators/ez/resource/templates/edit.html.erb
104
- - lib/generators/ez/resource/templates/index.html.erb
105
- - lib/generators/ez/resource/templates/migration.rb
106
- - lib/generators/ez/resource/templates/model.rb
107
- - lib/generators/ez/resource/templates/new.html.erb
108
- - lib/generators/ez/resource/templates/show.html.erb
109
- - lib/generators/ez/style/USAGE
110
- - lib/generators/ez/style/style_generator.rb
111
- - lib/generators/ez/style/templates/layout.html.erb
112
- - lib/generators/ez/user/templates/user_controller.rb
113
- - lib/generators/ez/user/user_generator.rb
114
- - lib/generators/ez/views/USAGE
115
80
  - lib/tasks/ez_tasks.rake
116
81
  homepage: http://www.jeffcohenonline.com/ez
117
82
  licenses:
@@ -133,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
98
  version: '0'
134
99
  requirements: []
135
100
  rubyforge_project:
136
- rubygems_version: 2.4.2
101
+ rubygems_version: 2.5.1
137
102
  signing_key:
138
103
  specification_version: 4
139
104
  summary: For educational purposes only.
@@ -1,26 +0,0 @@
1
- require 'json'
2
- require 'open-uri'
3
-
4
- module EZ
5
-
6
- def self.weather(location = 'Evanston, IL')
7
- # Only cache up to 30 locations to avoid abuse
8
- @wx = {} unless @wx && @wx.keys.count < 30
9
-
10
- # Cache based on location
11
- @wx[location] ||= begin
12
- puts "Getting the current weather from openweathermap.org..."
13
- wx = from_api("http://api.openweathermap.org/data/2.5/weather?q=#{location}&units=imperial")
14
- @wx[location] = wx[:main]
15
- end
16
-
17
- end
18
-
19
- def self.from_api(uri_string)
20
- uri = URI.parse(URI.escape(uri_string))
21
- string = open(uri).read
22
- JSON.parse(string, symbolize_names: true)
23
- end
24
-
25
- end
26
-
@@ -1,19 +0,0 @@
1
- module ActionController
2
- class Base
3
-
4
- if Rails.env.development?
5
-
6
- # before_action :ez_update_tables
7
-
8
- def ez_update_tables
9
- Rails.cache.fetch('ez-generate-yml') do
10
- EZ::DomainModeler.generate_models_yml
11
- end
12
- EZ::DomainModeler.update_tables(true)
13
- EZ::DomainModeler.dump_schema
14
- end
15
-
16
- end
17
-
18
- end
19
- end
@@ -1,28 +0,0 @@
1
- # require_relative './jeff_controller.rb'
2
-
3
- # module ActionDispatch
4
- # module Routing
5
- # class RouteSet
6
- # class Dispatcher
7
- # def controller(params, default_controller=true)
8
- # if params && params.key?(:controller)
9
- # controller_param = params[:controller]
10
- # controller_reference(controller_param)
11
- # end
12
- # rescue NameError => e
13
- # raise ActionController::RoutingError, e.message, e.backtrace if default_controller
14
- # end
15
-
16
- # def controller_reference(controller_param)
17
- # begin
18
- # const_name = @controller_class_names[controller_param] ||= "#{controller_param.camelize}Controller"
19
- # ActiveSupport::Dependencies.constantize(const_name)
20
- # rescue NameError => e
21
- # Kernel.class_eval("class ::#{const_name} < ApplicationController; end")
22
- # ActiveSupport::Dependencies.constantize("::#{const_name}")
23
- # end
24
- # end
25
- # end
26
- # end
27
- # end
28
- # end