rails_bootstrap_form 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/app/assets/stylesheets/rails_bootstrap_form.css +1 -0
  4. data/demo/.byebug_history +4 -0
  5. data/demo/.ruby-version +1 -0
  6. data/demo/Rakefile +10 -0
  7. data/demo/app/assets/config/manifest.js +1 -0
  8. data/demo/app/assets/stylesheets/application.scss +3 -0
  9. data/demo/app/channels/application_cable/channel.rb +8 -0
  10. data/demo/app/channels/application_cable/connection.rb +8 -0
  11. data/demo/app/controllers/application_controller.rb +6 -0
  12. data/demo/app/controllers/users_controller.rb +70 -0
  13. data/demo/app/helpers/application_helper.rb +6 -0
  14. data/demo/app/jobs/application_job.rb +6 -0
  15. data/demo/app/mailers/application_mailer.rb +8 -0
  16. data/demo/app/models/address.rb +10 -0
  17. data/demo/app/models/application_record.rb +7 -0
  18. data/demo/app/models/country.rb +17 -0
  19. data/demo/app/models/fruit.rb +14 -0
  20. data/demo/app/models/skill.rb +21 -0
  21. data/demo/app/models/user.rb +20 -0
  22. data/demo/app/models/user_skill.rb +8 -0
  23. data/demo/app/views/layouts/application.html.erb +15 -0
  24. data/demo/app/views/users/_form.html.erb +5 -0
  25. data/demo/app/views/users/_form_without_bootstrap_helpers.html.erb +49 -0
  26. data/demo/app/views/users/_vertical_form.html.erb +33 -0
  27. data/demo/app/views/users/edit.html.erb +1 -0
  28. data/demo/app/views/users/index.html.erb +42 -0
  29. data/demo/app/views/users/new.html.erb +1 -0
  30. data/demo/bin/bundle +111 -0
  31. data/demo/bin/rails +8 -0
  32. data/demo/bin/rake +8 -0
  33. data/demo/bin/setup +37 -0
  34. data/demo/config/application.rb +28 -0
  35. data/demo/config/boot.rb +9 -0
  36. data/demo/config/cable.yml +10 -0
  37. data/demo/config/database.yml +25 -0
  38. data/demo/config/environment.rb +9 -0
  39. data/demo/config/environments/development.rb +74 -0
  40. data/demo/config/environments/production.rb +97 -0
  41. data/demo/config/environments/test.rb +64 -0
  42. data/demo/config/initializers/assets.rb +16 -0
  43. data/demo/config/initializers/content_security_policy.rb +29 -0
  44. data/demo/config/initializers/filter_parameter_logging.rb +12 -0
  45. data/demo/config/initializers/inflections.rb +20 -0
  46. data/demo/config/initializers/permissions_policy.rb +17 -0
  47. data/demo/config/initializers/rails_bootstrap_form.rb +10 -0
  48. data/demo/config/locales/en.rb +16 -0
  49. data/demo/config/puma.rb +47 -0
  50. data/demo/config/routes.rb +9 -0
  51. data/demo/config/storage.yml +34 -0
  52. data/demo/config.ru +10 -0
  53. data/demo/db/migrate/20230514054308_create_countries.rb +12 -0
  54. data/demo/db/migrate/20230514054851_create_fruits.rb +12 -0
  55. data/demo/db/migrate/20230514055237_create_users.rb +21 -0
  56. data/demo/db/migrate/20230514055840_create_addresses.rb +17 -0
  57. data/demo/db/migrate/20230514060556_create_skills.rb +12 -0
  58. data/demo/db/migrate/20230514061100_create_user_skills.rb +13 -0
  59. data/demo/db/schema.rb +69 -0
  60. data/demo/db/seeds.rb +15 -0
  61. data/demo/public/favicon.ico +0 -0
  62. data/lib/generators/rails_bootstrap_form/install_generator.rb +25 -0
  63. data/lib/generators/rails_bootstrap_form/templates/install.rb +10 -0
  64. data/lib/rails_bootstrap_form/action_view_extensions/bootstrap_form_helper.rb +54 -0
  65. data/lib/rails_bootstrap_form/bootstrap_form_builder.rb +24 -0
  66. data/lib/rails_bootstrap_form/bootstrap_form_options.rb +71 -0
  67. data/lib/rails_bootstrap_form/configuration.rb +26 -0
  68. data/lib/rails_bootstrap_form/version.rb +1 -1
  69. data/lib/rails_bootstrap_form.rb +20 -1
  70. metadata +66 -1
@@ -0,0 +1,25 @@
1
+ # SQLite. Versions 3.8.0 and up are supported.
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem "sqlite3"
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3
@@ -0,0 +1,9 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ # Load the Rails application.
6
+ require_relative "application"
7
+
8
+ # Initialize the Rails application.
9
+ Rails.application.initialize!
@@ -0,0 +1,74 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ require "active_support/core_ext/integer/time"
6
+
7
+ Rails.application.configure do
8
+ # Settings specified here will take precedence over those in config/application.rb.
9
+
10
+ # In the development environment your application's code is reloaded any time
11
+ # it changes. This slows down response time but is perfect for development
12
+ # since you don't have to restart the web server when you make code changes.
13
+ config.cache_classes = false
14
+
15
+ # Do not eager load code on boot.
16
+ config.eager_load = false
17
+
18
+ # Show full error reports.
19
+ config.consider_all_requests_local = true
20
+
21
+ # Enable server timing
22
+ config.server_timing = true
23
+
24
+ # Enable/disable caching. By default caching is disabled.
25
+ # Run rails dev:cache to toggle caching.
26
+ if Rails.root.join("tmp/caching-dev.txt").exist?
27
+ config.action_controller.perform_caching = true
28
+ config.action_controller.enable_fragment_cache_logging = true
29
+
30
+ config.cache_store = :memory_store
31
+ config.public_file_server.headers = {
32
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
33
+ }
34
+ else
35
+ config.action_controller.perform_caching = false
36
+
37
+ config.cache_store = :null_store
38
+ end
39
+
40
+ # Store uploaded files on the local file system (see config/storage.yml for options).
41
+ config.active_storage.service = :local
42
+
43
+ # Don't care if the mailer can't send.
44
+ config.action_mailer.raise_delivery_errors = false
45
+
46
+ config.action_mailer.perform_caching = false
47
+
48
+ # Print deprecation notices to the Rails logger.
49
+ config.active_support.deprecation = :log
50
+
51
+ # Raise exceptions for disallowed deprecations.
52
+ config.active_support.disallowed_deprecation = :raise
53
+
54
+ # Tell Active Support which deprecation messages to disallow.
55
+ config.active_support.disallowed_deprecation_warnings = []
56
+
57
+ # Raise an error on page load if there are pending migrations.
58
+ config.active_record.migration_error = :page_load
59
+
60
+ # Highlight code that triggered database queries in logs.
61
+ config.active_record.verbose_query_logs = true
62
+
63
+ # Suppress logger output for asset requests.
64
+ config.assets.quiet = true
65
+
66
+ # Raises error for missing translations.
67
+ # config.i18n.raise_on_missing_translations = true
68
+
69
+ # Annotate rendered view with file names.
70
+ # config.action_view.annotate_rendered_view_with_filenames = true
71
+
72
+ # Uncomment if you wish to allow Action Cable access from any origin.
73
+ # config.action_cable.disable_request_forgery_protection = true
74
+ end
@@ -0,0 +1,97 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ require "active_support/core_ext/integer/time"
6
+
7
+ Rails.application.configure do
8
+ # Settings specified here will take precedence over those in config/application.rb.
9
+
10
+ # Code is not reloaded between requests.
11
+ config.cache_classes = true
12
+
13
+ # Eager load code on boot. This eager loads most of Rails and
14
+ # your application in memory, allowing both threaded web servers
15
+ # and those relying on copy on write to perform better.
16
+ # Rake tasks automatically ignore this option for performance.
17
+ config.eager_load = true
18
+
19
+ # Full error reports are disabled and caching is turned on.
20
+ config.consider_all_requests_local = false
21
+ config.action_controller.perform_caching = true
22
+
23
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
24
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
25
+ # config.require_master_key = true
26
+
27
+ # Disable serving static files from the `/public` folder by default since
28
+ # Apache or NGINX already handles this.
29
+ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
30
+
31
+ # Compress CSS using a preprocessor.
32
+ # config.assets.css_compressor = :sass
33
+
34
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
35
+ config.assets.compile = false
36
+
37
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
38
+ # config.asset_host = "http://assets.example.com"
39
+
40
+ # Specifies the header that your server uses for sending files.
41
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
42
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
43
+
44
+ # Store uploaded files on the local file system (see config/storage.yml for options).
45
+ config.active_storage.service = :local
46
+
47
+ # Mount Action Cable outside main process or domain.
48
+ # config.action_cable.mount_path = nil
49
+ # config.action_cable.url = "wss://example.com/cable"
50
+ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
51
+
52
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
53
+ # config.force_ssl = true
54
+
55
+ # Include generic and useful information about system operation, but avoid logging too much
56
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
57
+ config.log_level = :info
58
+
59
+ # Prepend all log lines with the following tags.
60
+ config.log_tags = [ :request_id ]
61
+
62
+ # Use a different cache store in production.
63
+ # config.cache_store = :mem_cache_store
64
+
65
+ # Use a real queuing backend for Active Job (and separate queues per environment).
66
+ # config.active_job.queue_adapter = :resque
67
+ # config.active_job.queue_name_prefix = "demo_production"
68
+
69
+ config.action_mailer.perform_caching = false
70
+
71
+ # Ignore bad email addresses and do not raise email delivery errors.
72
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
73
+ # config.action_mailer.raise_delivery_errors = false
74
+
75
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
76
+ # the I18n.default_locale when a translation cannot be found).
77
+ config.i18n.fallbacks = true
78
+
79
+ # Don't log any deprecations.
80
+ config.active_support.report_deprecations = false
81
+
82
+ # Use default logging formatter so that PID and timestamp are not suppressed.
83
+ config.log_formatter = ::Logger::Formatter.new
84
+
85
+ # Use a different logger for distributed setups.
86
+ # require "syslog/logger"
87
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
88
+
89
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
90
+ logger = ActiveSupport::Logger.new(STDOUT)
91
+ logger.formatter = config.log_formatter
92
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
93
+ end
94
+
95
+ # Do not dump schema after migrations.
96
+ config.active_record.dump_schema_after_migration = false
97
+ end
@@ -0,0 +1,64 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ require "active_support/core_ext/integer/time"
6
+
7
+ # The test environment is used exclusively to run your application's
8
+ # test suite. You never need to work with it otherwise. Remember that
9
+ # your test database is "scratch space" for the test suite and is wiped
10
+ # and recreated between test runs. Don't rely on the data there!
11
+
12
+ Rails.application.configure do
13
+ # Settings specified here will take precedence over those in config/application.rb.
14
+
15
+ # Turn false under Spring and add config.action_view.cache_template_loading = true.
16
+ config.cache_classes = true
17
+
18
+ # Eager loading loads your whole application. When running a single test locally,
19
+ # this probably isn't necessary. It's a good idea to do in a continuous integration
20
+ # system, or in some way before deploying your code.
21
+ config.eager_load = ENV["CI"].present?
22
+
23
+ # Configure public file server for tests with Cache-Control for performance.
24
+ config.public_file_server.enabled = true
25
+ config.public_file_server.headers = {
26
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
27
+ }
28
+
29
+ # Show full error reports and disable caching.
30
+ config.consider_all_requests_local = true
31
+ config.action_controller.perform_caching = false
32
+ config.cache_store = :null_store
33
+
34
+ # Raise exceptions instead of rendering exception templates.
35
+ config.action_dispatch.show_exceptions = false
36
+
37
+ # Disable request forgery protection in test environment.
38
+ config.action_controller.allow_forgery_protection = false
39
+
40
+ # Store uploaded files on the local file system in a temporary directory.
41
+ config.active_storage.service = :test
42
+
43
+ config.action_mailer.perform_caching = false
44
+
45
+ # Tell Action Mailer not to deliver emails to the real world.
46
+ # The :test delivery method accumulates sent emails in the
47
+ # ActionMailer::Base.deliveries array.
48
+ config.action_mailer.delivery_method = :test
49
+
50
+ # Print deprecation notices to the stderr.
51
+ config.active_support.deprecation = :stderr
52
+
53
+ # Raise exceptions for disallowed deprecations.
54
+ config.active_support.disallowed_deprecation = :raise
55
+
56
+ # Tell Active Support which deprecation messages to disallow.
57
+ config.active_support.disallowed_deprecation_warnings = []
58
+
59
+ # Raises error for missing translations.
60
+ # config.i18n.raise_on_missing_translations = true
61
+
62
+ # Annotate rendered view with file names.
63
+ # config.action_view.annotate_rendered_view_with_filenames = true
64
+ end
@@ -0,0 +1,16 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ # Be sure to restart your server when you modify this file.
6
+
7
+ # Version of your assets, change this if you want to expire all your assets.
8
+ Rails.application.config.assets.version = "1.0"
9
+
10
+ # Add additional assets to the asset load path.
11
+ # Rails.application.config.assets.paths << Emoji.images_path
12
+
13
+ # Precompile additional assets.
14
+ # application.js, application.css, and all non-JS/CSS in the app/assets
15
+ # folder are already added.
16
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ # Be sure to restart your server when you modify this file.
6
+
7
+ # Define an application-wide content security policy.
8
+ # See the Securing Rails Applications Guide for more information:
9
+ # https://guides.rubyonrails.org/security.html#content-security-policy-header
10
+
11
+ # Rails.application.configure do
12
+ # config.content_security_policy do |policy|
13
+ # policy.default_src :self, :https
14
+ # policy.font_src :self, :https, :data
15
+ # policy.img_src :self, :https, :data
16
+ # policy.object_src :none
17
+ # policy.script_src :self, :https
18
+ # policy.style_src :self, :https
19
+ # # Specify URI for violation reports
20
+ # # policy.report_uri "/csp-violation-report-endpoint"
21
+ # end
22
+ #
23
+ # # Generate session nonces for permitted importmap and inline scripts
24
+ # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
25
+ # config.content_security_policy_nonce_directives = %w(script-src)
26
+ #
27
+ # # Report violations without enforcing the policy.
28
+ # # config.content_security_policy_report_only = true
29
+ # end
@@ -0,0 +1,12 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ # Be sure to restart your server when you modify this file.
6
+
7
+ # Configure parameters to be filtered from the log file. Use this to limit dissemination of
8
+ # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
9
+ # notations and behaviors.
10
+ Rails.application.config.filter_parameters += [
11
+ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
12
+ ]
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ # Be sure to restart your server when you modify this file.
6
+
7
+ # Add new inflection rules using the following format. Inflections
8
+ # are locale specific, and you may define rules for as many different
9
+ # locales as you wish. All of these examples are active by default:
10
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
11
+ # inflect.plural /^(ox)$/i, "\\1en"
12
+ # inflect.singular /^(ox)en/i, "\\1"
13
+ # inflect.irregular "person", "people"
14
+ # inflect.uncountable %w( fish sheep )
15
+ # end
16
+
17
+ # These inflection rules are supported but not enabled by default:
18
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
19
+ # inflect.acronym "RESTful"
20
+ # end
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ # Be sure to restart your server when you modify this file.
6
+
7
+ # Define an application-wide HTTP permissions policy. For further
8
+ # information see https://developers.google.com/web/updates/2018/06/feature-policy
9
+ #
10
+ # Rails.application.config.permissions_policy do |f|
11
+ # f.camera :none
12
+ # f.gyroscope :none
13
+ # f.microphone :none
14
+ # f.usb :none
15
+ # f.fullscreen :self
16
+ # f.payment :self, "https://secure.example.com"
17
+ # end
@@ -0,0 +1,10 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ # Be sure to restart your server when you modify this file.
6
+
7
+ RailsBootstrapForm.configure do |config|
8
+ # to make forms non-compliant with W3C.
9
+ config.default_form_attributes = {role: "form", novalidate: true}
10
+ end
@@ -0,0 +1,16 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ {
6
+ en: {
7
+ activerecord: {
8
+ attributes: {
9
+
10
+ },
11
+ help_texts: {
12
+
13
+ },
14
+ },
15
+ }
16
+ }
@@ -0,0 +1,47 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ # Puma can serve each request in a thread from an internal thread pool.
6
+ # The `threads` method setting takes two numbers: a minimum and maximum.
7
+ # Any libraries that use thread pools should be configured to match
8
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
9
+ # and maximum; this matches the default thread size of Active Record.
10
+ #
11
+ max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
12
+ min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
13
+ threads min_threads_count, max_threads_count
14
+
15
+ # Specifies the `worker_timeout` threshold that Puma will use to wait before
16
+ # terminating a worker in development environments.
17
+ #
18
+ worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
19
+
20
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
21
+ #
22
+ port ENV.fetch("PORT") { 3000 }
23
+
24
+ # Specifies the `environment` that Puma will run in.
25
+ #
26
+ environment ENV.fetch("RAILS_ENV") { "development" }
27
+
28
+ # Specifies the `pidfile` that Puma will use.
29
+ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
30
+
31
+ # Specifies the number of `workers` to boot in clustered mode.
32
+ # Workers are forked web server processes. If using threads and workers together
33
+ # the concurrency of the application would be max `threads` * `workers`.
34
+ # Workers do not work on JRuby or Windows (both of which do not support
35
+ # processes).
36
+ #
37
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
38
+
39
+ # Use the `preload_app!` method when specifying a `workers` number.
40
+ # This directive tells Puma to first boot the application and load code
41
+ # before forking the application. This takes advantage of Copy On Write
42
+ # process behavior so workers use less memory.
43
+ #
44
+ # preload_app!
45
+
46
+ # Allow puma to be restarted by `bin/rails restart` command.
47
+ plugin :tmp_restart
@@ -0,0 +1,9 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ Rails.application.routes.draw do
6
+ root to: "users#index"
7
+
8
+ resources :users
9
+ end
@@ -0,0 +1,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket-<%= Rails.env %>
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket-<%= Rails.env %>
23
+
24
+ # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name-<%= Rails.env %>
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
data/demo/config.ru ADDED
@@ -0,0 +1,10 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ # This file is used by Rack-based servers to start the application.
6
+
7
+ require_relative "config/environment"
8
+
9
+ run Rails.application
10
+ Rails.application.load_server
@@ -0,0 +1,12 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ class CreateCountries < ActiveRecord::Migration[7.0]
6
+ def change
7
+ create_table :countries do |t|
8
+ t.string :name
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ class CreateFruits < ActiveRecord::Migration[7.0]
6
+ def change
7
+ create_table :fruits do |t|
8
+ t.string :name
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ class CreateUsers < ActiveRecord::Migration[7.0]
6
+ def change
7
+ create_table :users do |t|
8
+ t.string :name
9
+ t.string :email
10
+ t.string :password
11
+ t.string :mobile_number
12
+ t.string :blog_url
13
+ t.date :birth_date
14
+ t.references :fruit
15
+ t.boolean :terms
16
+ t.string :excellence
17
+ t.string :favorite_color
18
+ t.timestamps
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ class CreateAddresses < ActiveRecord::Migration[7.0]
6
+ def change
7
+ create_table :addresses, id: false do |t|
8
+ t.references :user, primary_key: true
9
+ t.references :country
10
+ t.string :street
11
+ t.string :city
12
+ t.string :state
13
+ t.string :postal_code
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ class CreateSkills < ActiveRecord::Migration[7.0]
6
+ def change
7
+ create_table :skills do |t|
8
+ t.string :name
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ class CreateUserSkills < ActiveRecord::Migration[7.0]
6
+ def change
7
+ create_table :user_skills do |t|
8
+ t.references :user
9
+ t.references :skill
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
data/demo/db/schema.rb ADDED
@@ -0,0 +1,69 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # This file is the source Rails uses to define your schema when running `bin/rails
6
+ # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema[7.0].define(version: 2023_05_14_061100) do
14
+ create_table "addresses", primary_key: "user_id", force: :cascade do |t|
15
+ t.integer "country_id"
16
+ t.string "street"
17
+ t.string "city"
18
+ t.string "state"
19
+ t.string "postal_code"
20
+ t.datetime "created_at", null: false
21
+ t.datetime "updated_at", null: false
22
+ t.index ["country_id"], name: "index_addresses_on_country_id"
23
+ t.index ["user_id"], name: "index_addresses_on_user_id"
24
+ end
25
+
26
+ create_table "countries", force: :cascade do |t|
27
+ t.string "name"
28
+ t.datetime "created_at", null: false
29
+ t.datetime "updated_at", null: false
30
+ end
31
+
32
+ create_table "fruits", force: :cascade do |t|
33
+ t.string "name"
34
+ t.datetime "created_at", null: false
35
+ t.datetime "updated_at", null: false
36
+ end
37
+
38
+ create_table "skills", force: :cascade do |t|
39
+ t.string "name"
40
+ t.datetime "created_at", null: false
41
+ t.datetime "updated_at", null: false
42
+ end
43
+
44
+ create_table "user_skills", force: :cascade do |t|
45
+ t.integer "user_id"
46
+ t.integer "skill_id"
47
+ t.datetime "created_at", null: false
48
+ t.datetime "updated_at", null: false
49
+ t.index ["skill_id"], name: "index_user_skills_on_skill_id"
50
+ t.index ["user_id"], name: "index_user_skills_on_user_id"
51
+ end
52
+
53
+ create_table "users", force: :cascade do |t|
54
+ t.string "name"
55
+ t.string "email"
56
+ t.string "password"
57
+ t.string "mobile_number"
58
+ t.string "blog_url"
59
+ t.date "birth_date"
60
+ t.integer "fruit_id"
61
+ t.boolean "terms"
62
+ t.string "excellence"
63
+ t.string "favorite_color"
64
+ t.datetime "created_at", null: false
65
+ t.datetime "updated_at", null: false
66
+ t.index ["fruit_id"], name: "index_users_on_fruit_id"
67
+ end
68
+
69
+ end