23 | <% end %>
24 |
25 | <%= render "devise/shared/links" %>
26 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization and
2 | # are automatically loaded by Rails. If you want to use locales other than
3 | # English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t "hello"
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t("hello") %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # To learn more about the API, please read the Rails Internationalization guide
20 | # at https://guides.rubyonrails.org/i18n.html.
21 | #
22 | # Be aware that YAML interprets the following case-insensitive strings as
23 | # booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
24 | # must be quoted to be interpreted as strings. For example:
25 | #
26 | # en:
27 | # "yes": yup
28 | # enabled: "ON"
29 |
30 | en:
31 | hello: "Hello world"
32 |
--------------------------------------------------------------------------------
/app/views/properties/_property.html.erb:
--------------------------------------------------------------------------------
1 |
30 | <%= f.label :current_password %> (we need your current password to confirm your changes)
31 | <%= f.password_field :current_password, autocomplete: "current-password" %>
32 |
33 |
34 |
35 | <%= f.submit "Update" %>
36 |
37 | <% end %>
38 |
39 |
Cancel my account
40 |
41 |
Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" }, method: :delete %>
42 |
43 | <%= link_to "Back", :back %>
44 |
--------------------------------------------------------------------------------
/config/puma.rb:
--------------------------------------------------------------------------------
1 | # This configuration file will be evaluated by Puma. The top-level methods that
2 | # are invoked here are part of Puma's configuration DSL. For more information
3 | # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
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 | max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
11 | min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
12 | threads min_threads_count, max_threads_count
13 |
14 | # Specifies that the worker count should equal the number of processors in production.
15 | if ENV["RAILS_ENV"] == "production"
16 | require "concurrent-ruby"
17 | worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count })
18 | workers worker_count if worker_count > 1
19 | end
20 |
21 | # Specifies the `worker_timeout` threshold that Puma will use to wait before
22 | # terminating a worker in development environments.
23 | worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
24 |
25 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
26 | port ENV.fetch("PORT") { 3000 }
27 |
28 | # Specifies the `environment` that Puma will run in.
29 | environment ENV.fetch("RAILS_ENV") { "development" }
30 |
31 | # Specifies the `pidfile` that Puma will use.
32 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
33 |
34 | # Allow puma to be restarted by `bin/rails restart` command.
35 | plugin :tmp_restart
36 |
--------------------------------------------------------------------------------
/app/views/shared/_navbar.html.erb:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # syntax = docker/dockerfile:1
2 |
3 | # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
4 | ARG RUBY_VERSION=3.2.2
5 | FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
6 |
7 | # Rails app lives here
8 | WORKDIR /rails
9 |
10 | # Set production environment
11 | ENV RAILS_ENV="production" \
12 | BUNDLE_DEPLOYMENT="1" \
13 | BUNDLE_PATH="/usr/local/bundle" \
14 | BUNDLE_WITHOUT="development"
15 |
16 |
17 | # Throw-away build stage to reduce size of final image
18 | FROM base as build
19 |
20 | # Install packages needed to build gems
21 | RUN apt-get update -qq && \
22 | apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config
23 |
24 | # Install application gems
25 | COPY Gemfile Gemfile.lock ./
26 | RUN bundle install && \
27 | rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
28 | bundle exec bootsnap precompile --gemfile
29 |
30 | # Copy application code
31 | COPY . .
32 |
33 | # Precompile bootsnap code for faster boot times
34 | RUN bundle exec bootsnap precompile app/ lib/
35 |
36 | # Precompiling assets for production without requiring secret RAILS_MASTER_KEY
37 | RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
38 |
39 |
40 | # Final stage for app image
41 | FROM base
42 |
43 | # Install packages needed for deployment
44 | RUN apt-get update -qq && \
45 | apt-get install --no-install-recommends -y curl libvips postgresql-client && \
46 | rm -rf /var/lib/apt/lists /var/cache/apt/archives
47 |
48 | # Copy built artifacts: gems, application
49 | COPY --from=build /usr/local/bundle /usr/local/bundle
50 | COPY --from=build /rails /rails
51 |
52 | # Run and own only the runtime files as a non-root user for security
53 | RUN useradd rails --create-home --shell /bin/bash && \
54 | chown -R rails:rails db log storage tmp
55 | USER rails:rails
56 |
57 | # Entrypoint prepares the database.
58 | ENTRYPOINT ["/rails/bin/docker-entrypoint"]
59 |
60 | # Start the server by default, this can be overwritten at runtime
61 | EXPOSE 3000
62 | CMD ["./bin/rails", "server"]
63 |
--------------------------------------------------------------------------------
/app/controllers/properties_controller.rb:
--------------------------------------------------------------------------------
1 | class PropertiesController < ApplicationController
2 | before_action :set_property, only: %i[ show edit update destroy ]
3 | before_action :authenticate_user!, except: %i[ index show ]
4 |
5 | # GET /properties or /properties.json
6 | def index
7 | # @properties = Property.all
8 | @pagy, @properties = pagy(Property.all)
9 | end
10 |
11 | # GET /properties/1 or /properties/1.json
12 | def show
13 | end
14 |
15 | # GET /properties/new
16 | def new
17 | @property = current_user.properties.build
18 | end
19 |
20 | # GET /properties/1/edit
21 | def edit
22 | end
23 |
24 | # POST /properties or /properties.json
25 | def create
26 | @property = current_user.properties.build(property_params)
27 |
28 | respond_to do |format|
29 | if @property.save
30 | format.html { redirect_to property_url(@property), notice: "Property was successfully created." }
31 | format.json { render :show, status: :created, location: @property }
32 | else
33 | format.html { render :new, status: :unprocessable_entity }
34 | format.json { render json: @property.errors, status: :unprocessable_entity }
35 | end
36 | end
37 | end
38 |
39 | # PATCH/PUT /properties/1 or /properties/1.json
40 | def update
41 | respond_to do |format|
42 | if @property.update(property_params)
43 | format.html { redirect_to property_url(@property), notice: "Property was successfully updated." }
44 | format.json { render :show, status: :ok, location: @property }
45 | else
46 | format.html { render :edit, status: :unprocessable_entity }
47 | format.json { render json: @property.errors, status: :unprocessable_entity }
48 | end
49 | end
50 | end
51 |
52 | # DELETE /properties/1 or /properties/1.json
53 | def destroy
54 | @property.destroy!
55 |
56 | respond_to do |format|
57 | format.html { redirect_to properties_url, notice: "Property was successfully destroyed." }
58 | format.json { head :no_content }
59 | end
60 | end
61 |
62 | private
63 | # Use callbacks to share common setup or constraints between actions.
64 | def set_property
65 | @property = Property.find(params[:id])
66 | end
67 |
68 | # Only allow a list of trusted parameters through.
69 | def property_params
70 | params.require(:property).permit(:user_id, :type_offer_id, :type_property_id, :description, :area, :price, feature_ids: [])
71 | end
72 | end
73 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source "https://rubygems.org"
2 |
3 | ruby "3.2.2"
4 |
5 | # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
6 | gem "rails", "~> 7.1.0"
7 |
8 | # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
9 | gem "sprockets-rails"
10 |
11 | # Use postgresql as the database for Active Record
12 | gem "pg", "~> 1.1"
13 |
14 | # Use the Puma web server [https://github.com/puma/puma]
15 | gem "puma", ">= 5.0"
16 |
17 | # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
18 | gem "importmap-rails"
19 |
20 | # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
21 | gem "turbo-rails"
22 |
23 | # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
24 | gem "stimulus-rails"
25 |
26 | # Build JSON APIs with ease [https://github.com/rails/jbuilder]
27 | gem "jbuilder"
28 |
29 | # Use Redis adapter to run Action Cable in production
30 | # gem "redis", ">= 4.0.1"
31 |
32 | # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
33 | # gem "kredis"
34 |
35 | # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
36 | # gem "bcrypt", "~> 3.1.7"
37 |
38 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
39 | gem "tzinfo-data", platforms: %i[ windows jruby ]
40 |
41 | # Reduces boot times through caching; required in config/boot.rb
42 | gem "bootsnap", require: false
43 |
44 | # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
45 | # gem "image_processing", "~> 1.2"
46 |
47 | group :development, :test do
48 | # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
49 | gem "debug", platforms: %i[ mri windows ]
50 | end
51 |
52 | group :development do
53 | # Use console on exceptions pages [https://github.com/rails/web-console]
54 | gem "web-console"
55 |
56 | # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
57 | # gem "rack-mini-profiler"
58 |
59 | # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
60 | # gem "spring"
61 |
62 | end
63 |
64 | group :test do
65 | # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
66 | gem "capybara"
67 | gem "selenium-webdriver"
68 | end
69 |
70 | gem "annotate", "~> 3.2"
71 |
72 | gem "faker", "~> 3.2"
73 |
74 | gem "devise", "~> 4.9"
75 |
76 | gem "pagy", "~> 6.1"
77 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | require "active_support/core_ext/integer/time"
2 |
3 | # The test environment is used exclusively to run your application's
4 | # test suite. You never need to work with it otherwise. Remember that
5 | # your test database is "scratch space" for the test suite and is wiped
6 | # and recreated between test runs. Don't rely on the data there!
7 |
8 | Rails.application.configure do
9 | # Settings specified here will take precedence over those in config/application.rb.
10 |
11 | # While tests run files are not watched, reloading is not necessary.
12 | config.enable_reloading = false
13 |
14 | # Eager loading loads your entire application. When running a single test locally,
15 | # this is usually not necessary, and can slow down your test suite. However, it's
16 | # recommended that you enable it in continuous integration systems to ensure eager
17 | # loading is working properly before deploying your code.
18 | config.eager_load = ENV["CI"].present?
19 |
20 | # Configure public file server for tests with Cache-Control for performance.
21 | config.public_file_server.enabled = true
22 | config.public_file_server.headers = {
23 | "Cache-Control" => "public, max-age=#{1.hour.to_i}"
24 | }
25 |
26 | # Show full error reports and disable caching.
27 | config.consider_all_requests_local = true
28 | config.action_controller.perform_caching = false
29 | config.cache_store = :null_store
30 |
31 | # Raise exceptions instead of rendering exception templates.
32 | config.action_dispatch.show_exceptions = :rescuable
33 |
34 | # Disable request forgery protection in test environment.
35 | config.action_controller.allow_forgery_protection = false
36 |
37 | # Store uploaded files on the local file system in a temporary directory.
38 | config.active_storage.service = :test
39 |
40 | config.action_mailer.perform_caching = false
41 |
42 | # Tell Action Mailer not to deliver emails to the real world.
43 | # The :test delivery method accumulates sent emails in the
44 | # ActionMailer::Base.deliveries array.
45 | config.action_mailer.delivery_method = :test
46 |
47 | # Print deprecation notices to the stderr.
48 | config.active_support.deprecation = :stderr
49 |
50 | # Raise exceptions for disallowed deprecations.
51 | config.active_support.disallowed_deprecation = :raise
52 |
53 | # Tell Active Support which deprecation messages to disallow.
54 | config.active_support.disallowed_deprecation_warnings = []
55 |
56 | # Raises error for missing translations.
57 | # config.i18n.raise_on_missing_translations = true
58 |
59 | # Annotate rendered view with file names.
60 | # config.action_view.annotate_rendered_view_with_filenames = true
61 |
62 | # Raise error when a before_action's only/except options reference missing actions
63 | config.action_controller.raise_on_missing_callback_actions = true
64 | end
65 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | require "active_support/core_ext/integer/time"
2 |
3 | Rails.application.configure do
4 | # Settings specified here will take precedence over those in config/application.rb.
5 |
6 | # In the development environment your application's code is reloaded any time
7 | # it changes. This slows down response time but is perfect for development
8 | # since you don't have to restart the web server when you make code changes.
9 | config.enable_reloading = true
10 |
11 | # Do not eager load code on boot.
12 | config.eager_load = false
13 |
14 | # Show full error reports.
15 | config.consider_all_requests_local = true
16 |
17 | # Enable server timing
18 | config.server_timing = true
19 |
20 | # Enable/disable caching. By default caching is disabled.
21 | # Run rails dev:cache to toggle caching.
22 | if Rails.root.join("tmp/caching-dev.txt").exist?
23 | config.action_controller.perform_caching = true
24 | config.action_controller.enable_fragment_cache_logging = true
25 |
26 | config.cache_store = :memory_store
27 | config.public_file_server.headers = {
28 | "Cache-Control" => "public, max-age=#{2.days.to_i}"
29 | }
30 | else
31 | config.action_controller.perform_caching = false
32 |
33 | config.cache_store = :null_store
34 | end
35 |
36 | # Store uploaded files on the local file system (see config/storage.yml for options).
37 | config.active_storage.service = :local
38 |
39 | # Don't care if the mailer can't send.
40 | config.action_mailer.raise_delivery_errors = false
41 |
42 | config.action_mailer.perform_caching = false
43 |
44 | # Print deprecation notices to the Rails logger.
45 | config.active_support.deprecation = :log
46 |
47 | # Raise exceptions for disallowed deprecations.
48 | config.active_support.disallowed_deprecation = :raise
49 |
50 | # Tell Active Support which deprecation messages to disallow.
51 | config.active_support.disallowed_deprecation_warnings = []
52 |
53 | # Raise an error on page load if there are pending migrations.
54 | config.active_record.migration_error = :page_load
55 |
56 | # Highlight code that triggered database queries in logs.
57 | config.active_record.verbose_query_logs = true
58 |
59 | # Highlight code that enqueued background job in logs.
60 | config.active_job.verbose_enqueue_logs = true
61 |
62 | # Suppress logger output for asset requests.
63 | config.assets.quiet = true
64 |
65 | # Raises error for missing translations.
66 | # config.i18n.raise_on_missing_translations = true
67 |
68 | # Annotate rendered view with file names.
69 | # config.action_view.annotate_rendered_view_with_filenames = true
70 |
71 | # Uncomment if you wish to allow Action Cable access from any origin.
72 | # config.action_cable.disable_request_forgery_protection = true
73 |
74 | # Raise error when a before_action's only/except options reference missing actions
75 | config.action_controller.raise_on_missing_callback_actions = true
76 | end
77 |
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | # PostgreSQL. Versions 9.3 and up are supported.
2 | #
3 | # Install the pg driver:
4 | # gem install pg
5 | # On macOS with Homebrew:
6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7 | # On Windows:
8 | # gem install pg
9 | # Choose the win32 build.
10 | # Install PostgreSQL and put its /bin directory on your path.
11 | #
12 | # Configure Using Gemfile
13 | # gem "pg"
14 | #
15 | default: &default
16 | adapter: postgresql
17 | encoding: unicode
18 | # For details on connection pooling, see Rails configuration guide
19 | # https://guides.rubyonrails.org/configuring.html#database-pooling
20 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
21 |
22 | development:
23 | <<: *default
24 | database: inforcap_house_development
25 |
26 | # The specified database role being used to connect to postgres.
27 | # To create additional roles in postgres see `$ createuser --help`.
28 | # When left blank, postgres will use the default role. This is
29 | # the same name as the operating system user running Rails.
30 | #username: inforcap_house
31 |
32 | # The password associated with the postgres role (username).
33 | #password:
34 |
35 | # Connect on a TCP socket. Omitted by default since the client uses a
36 | # domain socket that doesn't need configuration. Windows does not have
37 | # domain sockets, so uncomment these lines.
38 | #host: localhost
39 |
40 | # The TCP port the server listens on. Defaults to 5432.
41 | # If your server runs on a different port number, change accordingly.
42 | #port: 5432
43 |
44 | # Schema search path. The server defaults to $user,public
45 | #schema_search_path: myapp,sharedapp,public
46 |
47 | # Minimum log levels, in increasing order:
48 | # debug5, debug4, debug3, debug2, debug1,
49 | # log, notice, warning, error, fatal, and panic
50 | # Defaults to warning.
51 | #min_messages: notice
52 |
53 | # Warning: The database defined as "test" will be erased and
54 | # re-generated from your development database when you run "rake".
55 | # Do not set this db to the same as development or production.
56 | test:
57 | <<: *default
58 | database: inforcap_house_test
59 |
60 | # As with config/credentials.yml, you never want to store sensitive information,
61 | # like your database password, in your source code. If your source code is
62 | # ever seen by anyone, they now have access to your database.
63 | #
64 | # Instead, provide the password or a full connection URL as an environment
65 | # variable when you boot the app. For example:
66 | #
67 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
68 | #
69 | # If the connection URL is provided in the special DATABASE_URL environment
70 | # variable, Rails will automatically merge its configuration values on top of
71 | # the values provided in this file. Alternatively, you can specify a connection
72 | # URL environment variable explicitly:
73 | #
74 | # production:
75 | # url: <%= ENV["MY_APP_DATABASE_URL"] %>
76 | #
77 | # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
78 | # for a full overview on how database connection configuration can be specified.
79 | #
80 | production:
81 | <<: *default
82 | database: inforcap_house_production
83 | username: inforcap_house
84 | password: <%= ENV["INFORCAP_HOUSE_DATABASE_PASSWORD"] %>
85 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'bundle' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | require "rubygems"
12 |
13 | m = Module.new do
14 | module_function
15 |
16 | def invoked_as_script?
17 | File.expand_path($0) == File.expand_path(__FILE__)
18 | end
19 |
20 | def env_var_version
21 | ENV["BUNDLER_VERSION"]
22 | end
23 |
24 | def cli_arg_version
25 | return unless invoked_as_script? # don't want to hijack other binstubs
26 | return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27 | bundler_version = nil
28 | update_index = nil
29 | ARGV.each_with_index do |a, i|
30 | if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31 | bundler_version = a
32 | end
33 | next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34 | bundler_version = $1
35 | update_index = i
36 | end
37 | bundler_version
38 | end
39 |
40 | def gemfile
41 | gemfile = ENV["BUNDLE_GEMFILE"]
42 | return gemfile if gemfile && !gemfile.empty?
43 |
44 | File.expand_path("../Gemfile", __dir__)
45 | end
46 |
47 | def lockfile
48 | lockfile =
49 | case File.basename(gemfile)
50 | when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
51 | else "#{gemfile}.lock"
52 | end
53 | File.expand_path(lockfile)
54 | end
55 |
56 | def lockfile_version
57 | return unless File.file?(lockfile)
58 | lockfile_contents = File.read(lockfile)
59 | return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60 | Regexp.last_match(1)
61 | end
62 |
63 | def bundler_requirement
64 | @bundler_requirement ||=
65 | env_var_version ||
66 | cli_arg_version ||
67 | bundler_requirement_for(lockfile_version)
68 | end
69 |
70 | def bundler_requirement_for(version)
71 | return "#{Gem::Requirement.default}.a" unless version
72 |
73 | bundler_gem_version = Gem::Version.new(version)
74 |
75 | bundler_gem_version.approximate_recommendation
76 | end
77 |
78 | def load_bundler!
79 | ENV["BUNDLE_GEMFILE"] ||= gemfile
80 |
81 | activate_bundler
82 | end
83 |
84 | def activate_bundler
85 | gem_error = activation_error_handling do
86 | gem "bundler", bundler_requirement
87 | end
88 | return if gem_error.nil?
89 | require_error = activation_error_handling do
90 | require "bundler/version"
91 | end
92 | return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
93 | warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
94 | exit 42
95 | end
96 |
97 | def activation_error_handling
98 | yield
99 | nil
100 | rescue StandardError, LoadError => e
101 | e
102 | end
103 | end
104 |
105 | m.load_bundler!
106 |
107 | if m.invoked_as_script?
108 | load Gem.bin_path("bundler", "bundle")
109 | end
110 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
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.1].define(version: 2023_10_07_145618) do
14 | # These are extensions that must be enabled in order to support this database
15 | enable_extension "plpgsql"
16 |
17 | create_table "contacts", force: :cascade do |t|
18 | t.string "name"
19 | t.string "email"
20 | t.text "message"
21 | t.datetime "created_at", null: false
22 | t.datetime "updated_at", null: false
23 | end
24 |
25 | create_table "features", force: :cascade do |t|
26 | t.string "name"
27 | t.datetime "created_at", null: false
28 | t.datetime "updated_at", null: false
29 | end
30 |
31 | create_table "properties", force: :cascade do |t|
32 | t.bigint "user_id", null: false
33 | t.bigint "type_offer_id", null: false
34 | t.bigint "type_property_id", null: false
35 | t.text "description"
36 | t.integer "area"
37 | t.decimal "price"
38 | t.datetime "created_at", null: false
39 | t.datetime "updated_at", null: false
40 | t.index ["type_offer_id"], name: "index_properties_on_type_offer_id"
41 | t.index ["type_property_id"], name: "index_properties_on_type_property_id"
42 | t.index ["user_id"], name: "index_properties_on_user_id"
43 | end
44 |
45 | create_table "property_features", force: :cascade do |t|
46 | t.bigint "property_id", null: false
47 | t.bigint "feature_id", null: false
48 | t.datetime "created_at", null: false
49 | t.datetime "updated_at", null: false
50 | t.index ["feature_id"], name: "index_property_features_on_feature_id"
51 | t.index ["property_id"], name: "index_property_features_on_property_id"
52 | end
53 |
54 | create_table "type_offers", force: :cascade do |t|
55 | t.string "name"
56 | t.datetime "created_at", null: false
57 | t.datetime "updated_at", null: false
58 | end
59 |
60 | create_table "type_properties", force: :cascade do |t|
61 | t.string "name"
62 | t.datetime "created_at", null: false
63 | t.datetime "updated_at", null: false
64 | end
65 |
66 | create_table "users", force: :cascade do |t|
67 | t.string "email", default: "", null: false
68 | t.string "encrypted_password", default: "", null: false
69 | t.string "reset_password_token"
70 | t.datetime "reset_password_sent_at"
71 | t.datetime "remember_created_at"
72 | t.string "name"
73 | t.bigint "phone"
74 | t.integer "role", default: 0
75 | t.datetime "created_at", null: false
76 | t.datetime "updated_at", null: false
77 | t.index ["email"], name: "index_users_on_email", unique: true
78 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
79 | end
80 |
81 | add_foreign_key "properties", "type_offers"
82 | add_foreign_key "properties", "type_properties"
83 | add_foreign_key "properties", "users"
84 | add_foreign_key "property_features", "features"
85 | add_foreign_key "property_features", "properties"
86 | end
87 |
--------------------------------------------------------------------------------
/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at https://github.com/heartcombo/devise/wiki/I18n
2 |
3 | en:
4 | devise:
5 | confirmations:
6 | confirmed: "Your email address has been successfully confirmed."
7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9 | failure:
10 | already_authenticated: "You are already signed in."
11 | inactive: "Your account is not activated yet."
12 | invalid: "Invalid %{authentication_keys} or password."
13 | locked: "Your account is locked."
14 | last_attempt: "You have one more attempt before your account is locked."
15 | not_found_in_database: "Invalid %{authentication_keys} or password."
16 | timeout: "Your session expired. Please sign in again to continue."
17 | unauthenticated: "You need to sign in or sign up before continuing."
18 | unconfirmed: "You have to confirm your email address before continuing."
19 | mailer:
20 | confirmation_instructions:
21 | subject: "Confirmation instructions"
22 | reset_password_instructions:
23 | subject: "Reset password instructions"
24 | unlock_instructions:
25 | subject: "Unlock instructions"
26 | email_changed:
27 | subject: "Email Changed"
28 | password_change:
29 | subject: "Password Changed"
30 | omniauth_callbacks:
31 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
32 | success: "Successfully authenticated from %{kind} account."
33 | passwords:
34 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
35 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
36 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
37 | updated: "Your password has been changed successfully. You are now signed in."
38 | updated_not_active: "Your password has been changed successfully."
39 | registrations:
40 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
41 | signed_up: "Welcome! You have signed up successfully."
42 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
43 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
44 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
45 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
46 | updated: "Your account has been updated successfully."
47 | updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again."
48 | sessions:
49 | signed_in: "Signed in successfully."
50 | signed_out: "Signed out successfully."
51 | already_signed_out: "Signed out successfully."
52 | unlocks:
53 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
54 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
55 | unlocked: "Your account has been unlocked successfully. Please sign in to continue."
56 | errors:
57 | messages:
58 | already_confirmed: "was already confirmed, please try signing in"
59 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
60 | expired: "has expired, please request a new one"
61 | not_found: "not found"
62 | not_locked: "was not locked"
63 | not_saved:
64 | one: "1 error prohibited this %{resource} from being saved:"
65 | other: "%{count} errors prohibited this %{resource} from being saved:"
66 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | require "active_support/core_ext/integer/time"
2 |
3 | Rails.application.configure do
4 | # Settings specified here will take precedence over those in config/application.rb.
5 |
6 | # Code is not reloaded between requests.
7 | config.enable_reloading = false
8 |
9 | # Eager load code on boot. This eager loads most of Rails and
10 | # your application in memory, allowing both threaded web servers
11 | # and those relying on copy on write to perform better.
12 | # Rake tasks automatically ignore this option for performance.
13 | config.eager_load = true
14 |
15 | # Full error reports are disabled and caching is turned on.
16 | config.consider_all_requests_local = false
17 | config.action_controller.perform_caching = true
18 |
19 | # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
20 | # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
21 | # config.require_master_key = true
22 |
23 | # Enable static file serving from the `/public` folder (turn off if using NGINX/Apache for it).
24 | config.public_file_server.enabled = true
25 |
26 | # Compress CSS using a preprocessor.
27 | # config.assets.css_compressor = :sass
28 |
29 | # Do not fallback to assets pipeline if a precompiled asset is missed.
30 | config.assets.compile = false
31 |
32 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
33 | # config.asset_host = "http://assets.example.com"
34 |
35 | # Specifies the header that your server uses for sending files.
36 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
37 | # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
38 |
39 | # Store uploaded files on the local file system (see config/storage.yml for options).
40 | config.active_storage.service = :local
41 |
42 | # Mount Action Cable outside main process or domain.
43 | # config.action_cable.mount_path = nil
44 | # config.action_cable.url = "wss://example.com/cable"
45 | # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
46 |
47 | # Assume all access to the app is happening through a SSL-terminating reverse proxy.
48 | # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
49 | # config.assume_ssl = true
50 |
51 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
52 | config.force_ssl = true
53 |
54 | # Log to STDOUT by default
55 | config.logger = ActiveSupport::Logger.new(STDOUT)
56 | .tap { |logger| logger.formatter = ::Logger::Formatter.new }
57 | .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
58 |
59 | # Prepend all log lines with the following tags.
60 | config.log_tags = [ :request_id ]
61 |
62 | # Info include generic and useful information about system operation, but avoids logging too much
63 | # information to avoid inadvertent exposure of personally identifiable information (PII). If you
64 | # want to log everything, set the level to "debug".
65 | config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
66 |
67 | # Use a different cache store in production.
68 | # config.cache_store = :mem_cache_store
69 |
70 | # Use a real queuing backend for Active Job (and separate queues per environment).
71 | # config.active_job.queue_adapter = :resque
72 | # config.active_job.queue_name_prefix = "inforcap_house_production"
73 |
74 | config.action_mailer.perform_caching = false
75 |
76 | # Ignore bad email addresses and do not raise email delivery errors.
77 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
78 | # config.action_mailer.raise_delivery_errors = false
79 |
80 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
81 | # the I18n.default_locale when a translation cannot be found).
82 | config.i18n.fallbacks = true
83 |
84 | # Don't log any deprecations.
85 | config.active_support.report_deprecations = false
86 |
87 | # Do not dump schema after migrations.
88 | config.active_record.dump_schema_after_migration = false
89 |
90 | # Enable DNS rebinding protection and other `Host` header attacks.
91 | # config.hosts = [
92 | # "example.com", # Allow requests from example.com
93 | # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
94 | # ]
95 | # Skip DNS rebinding protection for the default health check endpoint.
96 | # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
97 | end
98 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Reforzamiento Inforcap Ruby on Rails - Proyecto InforcapHouse
2 |
3 | Este proyecto hace parte de un reforzamiento dado a los estudiantes de Inforcap, es una guía paso a paso para crear proyectos tipo MVP (Producto Mínimo Viable) haciendo uso del framework Ruby on Rails. El objetivo principal es repasar los conceptos básicos del framework, hacer uso de las mejores prácticas y crear un producto mínimo viable.
4 |
5 | Realizaremos el sitio web de una empresa dedicada a catalogar inmuebles para su compra y venta, donde se pueden visualizar los inmuebles y los usuarios pueden dejar sus reseñas
6 |
7 | ## Descripción
8 |
9 | Este proyecto estaría dirigido a personas que quieran aprender a crear aplicaciones web con Ruby on Rails, desde cero, hasta llegar a un producto mínimo viable. Si ya tienes conocimientos previos de Ruby on Rails, sería un buen repaso de los conceptos básicos y una buena práctica para mejorar tus habilidades. El proyecto se divide en las siguientes etapas:
10 |
11 | - [x] Etapa 1: Creación del proyecto
12 | - [x] Etapa 2: Generar Vistas estaticas
13 | - [x] Etapa 3: Generar Modelos de referencia
14 | - [x] Etapa 4: Integrar Autenticación de usuarios
15 | - [x] Etapa 5: Generar Scaffold de los inmuebles
16 | - [x] Etapa 6: Integrar ActiveStorage y relaciones polimorficas
17 | - [x] Etapa 7: Aplicar estilos a las vistas
18 | - [x] Etapa 8: Solicitar inmuebles
19 |
20 | ### El proyecto esta desarrollado siguiendo la siguiente premisa
21 |
22 | **InforcapHouse** es una empresa que esta incursionando en la venta de inmuebles, inicialmente publicaban los inmuebles en grupos de facebook o en instagram y están satisfechos con ambas plataformas 🖥️🛍️. Sin embargo, están buscando expandirse y crear su propia presencia en línea a través de un sitio web.
23 |
24 | El principal problema que enfrentan es la necesidad de una plataforma confiable y estable que cumpla con todos sus requerimientos:
25 |
26 | - Paginas estaticas, Inicio, terminos legales.
27 | - Formulario de contacto.
28 | - Autenticación de usuarios, 2 roles de usuario (Admin, User)
29 | - Inmueble con la siguiente información; Tipo de inmueble, tipo de oferta, descripción del inmueble, area, precio, caracteristicas (Estas deben poder seleccionar una o multiples), Foto e información de contacto.
30 |
31 | Aquí es donde entras tú 😊. Tu desafío es presentar una propuesta de desarrollo que sea competitiva, destacando entre otras empresas y profesionales. Presentas una propuesta económica atractiva con un presupuesto justo, lo que te permite obtener una ganancia 💰, ofreciendo un excelente plazo de entrega. Lo más destacado de tu propuesta es el desarrollo de un MVP utilizando el Design Thinking y sus diversas etapas. La cereza en el pastel 🍒 es tu promesa de un tiempo de desarrollo de solo 4 horas para el desarrollo del prototipado.
32 |
33 | El cliente toma la decisión y... ¡Felicidades! 🎉 Has ganado el proyecto. Recibes un anticipo y ahora puedes empezar a trabajar en el proyecto. Recuerda, necesitas tener conocimientos previos de frontend (HTML, CSS, JavaScript, Bootstrap) y backend (PostgreSQL, Ruby, Ruby on Rails, Heroku) para llevar a cabo este proyecto. ¡Vamos a empezar! 💪🚀
34 |
35 | ## Visuales
36 |
37 | Capturas de pantalla, videos o GIFs que demuestran lo que hace el proyecto y cómo usarlo.
38 |
39 | ## Empezando 🚀
40 |
41 | Estas instrucciones te guiarán para obtener una copia de este proyecto en funcionamiento en tu máquina local para propósitos de desarrollo y pruebas. Ten en cuenta que el proyecto está en desarrollo y puede tener cambios en el futuro, por lo que se recomienda clonar el proyecto en lugar de descargarlo, para que puedas obtener las actualizaciones más recientes. También puedes hacer un fork del proyecto para contribuir con el desarrollo del mismo y estar al tanto de las actualizaciones.
42 |
43 | Para obtener una copia local en funcionamiento, sigue estos pasos.
44 |
45 | ```bash
46 | git clone git@github.com:brayandiazc/InforcapHouse.git
47 | ```
48 |
49 | Ingresa a la carpeta del proyecto
50 |
51 | ```bash
52 | cd InforcapHouse
53 | ```
54 |
55 | Con estos simples pasos ya estas listo para comenzar a desarrollar.
56 |
57 | ### Prerrequisitos 📋
58 |
59 | Antes de comenzar, asegúrate de cumplir con los siguientes requisitos:
60 |
61 | - Sistema Operativo: Windows, Linux, macOS, WSL
62 | - Lenguaje de programación Ruby 3.2.2
63 | - Framework Ruby on Rails 7.1.0
64 | - Base de datos Postgresql
65 |
66 | Se recomienda usar un sistema unix-like (Linux, macOS, WSL) para el desarrollo de este proyecto. En caso de usar Windows, se recomienda usar WSL (Windows Subsystem for Linux) para el desarrollo de este proyecto. Si no se tiene instalado WSL, puedes seguir la siguiente guía de instalación: [Instalación de WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
67 |
68 | Si no tienes instalado Ruby y Ruby on Rails, puedes seguir la siguiente guía de instalación: [Instalación de Ruby](https://www.ruby-lang.org/es/documentation/installation/)
69 |
70 | Si no tienes instalado Postgresql, puedes seguir la siguiente guía de instalación: [Instalación de Postgresql](https://www.postgresql.org/download/)
71 |
72 | ### Instalación 🔧
73 |
74 | Para poder ejecutar el proyecto después de haberlo clonado, debes ejecutar los siguientes pasos en tu terminal:
75 |
76 | ```bash
77 | bundle install
78 | ```
79 |
80 | ```bash
81 | rails db:create
82 | ```
83 |
84 | ```bash
85 | rails db:migrate
86 | ```
87 |
88 | ```bash
89 | rails db:seed
90 | ```
91 |
92 | ```bash
93 | rails s
94 | ```
95 |
96 | ## Despliegue 📦
97 |
98 | Para el despliegue hare uso de [Heroku](https://www.heroku.com/), una plataforma como servicio de computación en la nube que soporta distintos lenguajes de programación. Las instrucciones para el despliegue se encuentran en la siguiente archivo: [Despliegue](assets/README.md)
99 |
100 | ## Construido Con 🛠️
101 |
102 | Herramientas utilizadas para crear el proyecto:
103 |
104 | - [Ruby](https://www.ruby-lang.org/es/) - El lenguaje utilizado
105 | - [Ruby on Rails](https://rubyonrails.org) - El framework web utilizado
106 | - [Ruby gems](https://rubygems.org) - Gestión de dependencias
107 | - [Postgresql](https://www.postgresql.org) - Sistema de base de datos
108 | - [Bootstrap](https://getbootstrap.com) - Framework de CSS
109 |
110 | ## Soporte
111 |
112 | Si tienes algún problema o sugerencia, por favor abre un problema [aquí](https://github.com/brayandiazc/Aprendiendo-RubyOnRails/issues).
113 |
114 | ## Roadmap
115 |
116 | Ideas, mejoras planificadas y actualizaciones futuras
117 |
118 | para el proyecto actual.
119 |
120 | ## Versionado 📌
121 |
122 | Estoy usando [Git](https://git-scm.com) para el versionado.
123 |
124 | ## Autor ✒️
125 |
126 | - [Brayan Diaz C](https://github.com/brayandiazc)
127 |
128 | ## Licencia 📄
129 |
130 | Este proyecto está bajo la Licencia MIT - ve el archivo [LICENSE.md](LICENSE.md) para detalles
131 |
132 | ## Expresiones de Gratitud 🎁
133 |
134 | Si encontraste cualquier valor en este proyecto o quieres contribuir, aquí está lo que puedes hacer:
135 |
136 | - Comparte este proyecto con otros
137 | - haz un fork de este proyecto
138 | - Deja una estrella ⭐️
139 | - Inicia un nuevo issue o contribuye con un PR
140 | - Muestra tu agradecimiento diciendo gracias en un nuevo Issue.
141 |
142 | ⌨️ con ❤️ por [Brayan Diaz C](https://github.com/brayandiazc) 😊
143 |
144 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | actioncable (7.1.0)
5 | actionpack (= 7.1.0)
6 | activesupport (= 7.1.0)
7 | nio4r (~> 2.0)
8 | websocket-driver (>= 0.6.1)
9 | zeitwerk (~> 2.6)
10 | actionmailbox (7.1.0)
11 | actionpack (= 7.1.0)
12 | activejob (= 7.1.0)
13 | activerecord (= 7.1.0)
14 | activestorage (= 7.1.0)
15 | activesupport (= 7.1.0)
16 | mail (>= 2.7.1)
17 | net-imap
18 | net-pop
19 | net-smtp
20 | actionmailer (7.1.0)
21 | actionpack (= 7.1.0)
22 | actionview (= 7.1.0)
23 | activejob (= 7.1.0)
24 | activesupport (= 7.1.0)
25 | mail (~> 2.5, >= 2.5.4)
26 | net-imap
27 | net-pop
28 | net-smtp
29 | rails-dom-testing (~> 2.2)
30 | actionpack (7.1.0)
31 | actionview (= 7.1.0)
32 | activesupport (= 7.1.0)
33 | nokogiri (>= 1.8.5)
34 | rack (>= 2.2.4)
35 | rack-session (>= 1.0.1)
36 | rack-test (>= 0.6.3)
37 | rails-dom-testing (~> 2.2)
38 | rails-html-sanitizer (~> 1.6)
39 | actiontext (7.1.0)
40 | actionpack (= 7.1.0)
41 | activerecord (= 7.1.0)
42 | activestorage (= 7.1.0)
43 | activesupport (= 7.1.0)
44 | globalid (>= 0.6.0)
45 | nokogiri (>= 1.8.5)
46 | actionview (7.1.0)
47 | activesupport (= 7.1.0)
48 | builder (~> 3.1)
49 | erubi (~> 1.11)
50 | rails-dom-testing (~> 2.2)
51 | rails-html-sanitizer (~> 1.6)
52 | activejob (7.1.0)
53 | activesupport (= 7.1.0)
54 | globalid (>= 0.3.6)
55 | activemodel (7.1.0)
56 | activesupport (= 7.1.0)
57 | activerecord (7.1.0)
58 | activemodel (= 7.1.0)
59 | activesupport (= 7.1.0)
60 | timeout (>= 0.4.0)
61 | activestorage (7.1.0)
62 | actionpack (= 7.1.0)
63 | activejob (= 7.1.0)
64 | activerecord (= 7.1.0)
65 | activesupport (= 7.1.0)
66 | marcel (~> 1.0)
67 | activesupport (7.1.0)
68 | base64
69 | bigdecimal
70 | concurrent-ruby (~> 1.0, >= 1.0.2)
71 | connection_pool (>= 2.2.5)
72 | drb
73 | i18n (>= 1.6, < 2)
74 | minitest (>= 5.1)
75 | mutex_m
76 | tzinfo (~> 2.0)
77 | addressable (2.8.5)
78 | public_suffix (>= 2.0.2, < 6.0)
79 | annotate (3.2.0)
80 | activerecord (>= 3.2, < 8.0)
81 | rake (>= 10.4, < 14.0)
82 | base64 (0.1.1)
83 | bcrypt (3.1.19)
84 | bigdecimal (3.1.4)
85 | bindex (0.8.1)
86 | bootsnap (1.16.0)
87 | msgpack (~> 1.2)
88 | builder (3.2.4)
89 | capybara (3.39.2)
90 | addressable
91 | matrix
92 | mini_mime (>= 0.1.3)
93 | nokogiri (~> 1.8)
94 | rack (>= 1.6.0)
95 | rack-test (>= 0.6.3)
96 | regexp_parser (>= 1.5, < 3.0)
97 | xpath (~> 3.2)
98 | concurrent-ruby (1.2.2)
99 | connection_pool (2.4.1)
100 | crass (1.0.6)
101 | date (3.3.3)
102 | debug (1.8.0)
103 | irb (>= 1.5.0)
104 | reline (>= 0.3.1)
105 | devise (4.9.2)
106 | bcrypt (~> 3.0)
107 | orm_adapter (~> 0.1)
108 | railties (>= 4.1.0)
109 | responders
110 | warden (~> 1.2.3)
111 | drb (2.1.1)
112 | ruby2_keywords
113 | erubi (1.12.0)
114 | faker (3.2.1)
115 | i18n (>= 1.8.11, < 2)
116 | globalid (1.2.1)
117 | activesupport (>= 6.1)
118 | i18n (1.14.1)
119 | concurrent-ruby (~> 1.0)
120 | importmap-rails (1.2.1)
121 | actionpack (>= 6.0.0)
122 | railties (>= 6.0.0)
123 | io-console (0.6.0)
124 | irb (1.8.1)
125 | rdoc
126 | reline (>= 0.3.8)
127 | jbuilder (2.11.5)
128 | actionview (>= 5.0.0)
129 | activesupport (>= 5.0.0)
130 | loofah (2.21.3)
131 | crass (~> 1.0.2)
132 | nokogiri (>= 1.12.0)
133 | mail (2.8.1)
134 | mini_mime (>= 0.1.1)
135 | net-imap
136 | net-pop
137 | net-smtp
138 | marcel (1.0.2)
139 | matrix (0.4.2)
140 | mini_mime (1.1.5)
141 | minitest (5.20.0)
142 | msgpack (1.7.2)
143 | mutex_m (0.1.2)
144 | net-imap (0.4.0)
145 | date
146 | net-protocol
147 | net-pop (0.1.2)
148 | net-protocol
149 | net-protocol (0.2.1)
150 | timeout
151 | net-smtp (0.4.0)
152 | net-protocol
153 | nio4r (2.5.9)
154 | nokogiri (1.15.4-x86_64-linux)
155 | racc (~> 1.4)
156 | orm_adapter (0.5.0)
157 | pagy (6.1.0)
158 | pg (1.5.4)
159 | psych (5.1.0)
160 | stringio
161 | public_suffix (5.0.3)
162 | puma (6.4.0)
163 | nio4r (~> 2.0)
164 | racc (1.7.1)
165 | rack (3.0.8)
166 | rack-session (2.0.0)
167 | rack (>= 3.0.0)
168 | rack-test (2.1.0)
169 | rack (>= 1.3)
170 | rackup (2.1.0)
171 | rack (>= 3)
172 | webrick (~> 1.8)
173 | rails (7.1.0)
174 | actioncable (= 7.1.0)
175 | actionmailbox (= 7.1.0)
176 | actionmailer (= 7.1.0)
177 | actionpack (= 7.1.0)
178 | actiontext (= 7.1.0)
179 | actionview (= 7.1.0)
180 | activejob (= 7.1.0)
181 | activemodel (= 7.1.0)
182 | activerecord (= 7.1.0)
183 | activestorage (= 7.1.0)
184 | activesupport (= 7.1.0)
185 | bundler (>= 1.15.0)
186 | railties (= 7.1.0)
187 | rails-dom-testing (2.2.0)
188 | activesupport (>= 5.0.0)
189 | minitest
190 | nokogiri (>= 1.6)
191 | rails-html-sanitizer (1.6.0)
192 | loofah (~> 2.21)
193 | nokogiri (~> 1.14)
194 | railties (7.1.0)
195 | actionpack (= 7.1.0)
196 | activesupport (= 7.1.0)
197 | irb
198 | rackup (>= 1.0.0)
199 | rake (>= 12.2)
200 | thor (~> 1.0, >= 1.2.2)
201 | zeitwerk (~> 2.6)
202 | rake (13.0.6)
203 | rdoc (6.5.0)
204 | psych (>= 4.0.0)
205 | regexp_parser (2.8.1)
206 | reline (0.3.9)
207 | io-console (~> 0.5)
208 | responders (3.1.0)
209 | actionpack (>= 5.2)
210 | railties (>= 5.2)
211 | rexml (3.2.6)
212 | ruby2_keywords (0.0.5)
213 | rubyzip (2.3.2)
214 | selenium-webdriver (4.13.1)
215 | rexml (~> 3.2, >= 3.2.5)
216 | rubyzip (>= 1.2.2, < 3.0)
217 | websocket (~> 1.0)
218 | sprockets (4.2.1)
219 | concurrent-ruby (~> 1.0)
220 | rack (>= 2.2.4, < 4)
221 | sprockets-rails (3.4.2)
222 | actionpack (>= 5.2)
223 | activesupport (>= 5.2)
224 | sprockets (>= 3.0.0)
225 | stimulus-rails (1.2.2)
226 | railties (>= 6.0.0)
227 | stringio (3.0.8)
228 | thor (1.2.2)
229 | timeout (0.4.0)
230 | turbo-rails (1.4.0)
231 | actionpack (>= 6.0.0)
232 | activejob (>= 6.0.0)
233 | railties (>= 6.0.0)
234 | tzinfo (2.0.6)
235 | concurrent-ruby (~> 1.0)
236 | warden (1.2.9)
237 | rack (>= 2.0.9)
238 | web-console (4.2.1)
239 | actionview (>= 6.0.0)
240 | activemodel (>= 6.0.0)
241 | bindex (>= 0.4.0)
242 | railties (>= 6.0.0)
243 | webrick (1.8.1)
244 | websocket (1.2.10)
245 | websocket-driver (0.7.6)
246 | websocket-extensions (>= 0.1.0)
247 | websocket-extensions (0.1.5)
248 | xpath (3.2.0)
249 | nokogiri (~> 1.8)
250 | zeitwerk (2.6.12)
251 |
252 | PLATFORMS
253 | x86_64-linux
254 |
255 | DEPENDENCIES
256 | annotate (~> 3.2)
257 | bootsnap
258 | capybara
259 | debug
260 | devise (~> 4.9)
261 | faker (~> 3.2)
262 | importmap-rails
263 | jbuilder
264 | pagy (~> 6.1)
265 | pg (~> 1.1)
266 | puma (>= 5.0)
267 | rails (~> 7.1.0)
268 | selenium-webdriver
269 | sprockets-rails
270 | stimulus-rails
271 | turbo-rails
272 | tzinfo-data
273 | web-console
274 |
275 | RUBY VERSION
276 | ruby 3.2.2p53
277 |
278 | BUNDLED WITH
279 | 2.4.20
280 |
--------------------------------------------------------------------------------
/config/initializers/devise.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Assuming you have not yet modified this file, each configuration option below
4 | # is set to its default value. Note that some are commented out while others
5 | # are not: uncommented lines are intended to protect your configuration from
6 | # breaking changes in upgrades (i.e., in the event that future versions of
7 | # Devise change the default values for those options).
8 | #
9 | # Use this hook to configure devise mailer, warden hooks and so forth.
10 | # Many of these configuration options can be set straight in your model.
11 | Devise.setup do |config|
12 | # The secret key used by Devise. Devise uses this key to generate
13 | # random tokens. Changing this key will render invalid all existing
14 | # confirmation, reset password and unlock tokens in the database.
15 | # Devise will use the `secret_key_base` as its `secret_key`
16 | # by default. You can change it below and use your own secret key.
17 | # config.secret_key = 'b50226fb9f712afa839319140cc916eacfff7ed6d4a600b5993880cbb58362d5bb4de34656fb36873e373e5c369dc6abb232af0a886a1bcd46912a43de2aad9f'
18 |
19 | # ==> Controller configuration
20 | # Configure the parent class to the devise controllers.
21 | # config.parent_controller = 'DeviseController'
22 |
23 | # ==> Mailer Configuration
24 | # Configure the e-mail address which will be shown in Devise::Mailer,
25 | # note that it will be overwritten if you use your own mailer class
26 | # with default "from" parameter.
27 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
28 |
29 | # Configure the class responsible to send e-mails.
30 | # config.mailer = 'Devise::Mailer'
31 |
32 | # Configure the parent class responsible to send e-mails.
33 | # config.parent_mailer = 'ActionMailer::Base'
34 |
35 | # ==> ORM configuration
36 | # Load and configure the ORM. Supports :active_record (default) and
37 | # :mongoid (bson_ext recommended) by default. Other ORMs may be
38 | # available as additional gems.
39 | require 'devise/orm/active_record'
40 |
41 | # ==> Configuration for any authentication mechanism
42 | # Configure which keys are used when authenticating a user. The default is
43 | # just :email. You can configure it to use [:username, :subdomain], so for
44 | # authenticating a user, both parameters are required. Remember that those
45 | # parameters are used only when authenticating and not when retrieving from
46 | # session. If you need permissions, you should implement that in a before filter.
47 | # You can also supply a hash where the value is a boolean determining whether
48 | # or not authentication should be aborted when the value is not present.
49 | # config.authentication_keys = [:email]
50 |
51 | # Configure parameters from the request object used for authentication. Each entry
52 | # given should be a request method and it will automatically be passed to the
53 | # find_for_authentication method and considered in your model lookup. For instance,
54 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
55 | # The same considerations mentioned for authentication_keys also apply to request_keys.
56 | # config.request_keys = []
57 |
58 | # Configure which authentication keys should be case-insensitive.
59 | # These keys will be downcased upon creating or modifying a user and when used
60 | # to authenticate or find a user. Default is :email.
61 | config.case_insensitive_keys = [:email]
62 |
63 | # Configure which authentication keys should have whitespace stripped.
64 | # These keys will have whitespace before and after removed upon creating or
65 | # modifying a user and when used to authenticate or find a user. Default is :email.
66 | config.strip_whitespace_keys = [:email]
67 |
68 | # Tell if authentication through request.params is enabled. True by default.
69 | # It can be set to an array that will enable params authentication only for the
70 | # given strategies, for example, `config.params_authenticatable = [:database]` will
71 | # enable it only for database (email + password) authentication.
72 | # config.params_authenticatable = true
73 |
74 | # Tell if authentication through HTTP Auth is enabled. False by default.
75 | # It can be set to an array that will enable http authentication only for the
76 | # given strategies, for example, `config.http_authenticatable = [:database]` will
77 | # enable it only for database authentication.
78 | # For API-only applications to support authentication "out-of-the-box", you will likely want to
79 | # enable this with :database unless you are using a custom strategy.
80 | # The supported strategies are:
81 | # :database = Support basic authentication with authentication key + password
82 | # config.http_authenticatable = false
83 |
84 | # If 401 status code should be returned for AJAX requests. True by default.
85 | # config.http_authenticatable_on_xhr = true
86 |
87 | # The realm used in Http Basic Authentication. 'Application' by default.
88 | # config.http_authentication_realm = 'Application'
89 |
90 | # It will change confirmation, password recovery and other workflows
91 | # to behave the same regardless if the e-mail provided was right or wrong.
92 | # Does not affect registerable.
93 | # config.paranoid = true
94 |
95 | # By default Devise will store the user in session. You can skip storage for
96 | # particular strategies by setting this option.
97 | # Notice that if you are skipping storage for all authentication paths, you
98 | # may want to disable generating routes to Devise's sessions controller by
99 | # passing skip: :sessions to `devise_for` in your config/routes.rb
100 | config.skip_session_storage = [:http_auth]
101 |
102 | # By default, Devise cleans up the CSRF token on authentication to
103 | # avoid CSRF token fixation attacks. This means that, when using AJAX
104 | # requests for sign in and sign up, you need to get a new CSRF token
105 | # from the server. You can disable this option at your own risk.
106 | # config.clean_up_csrf_token_on_authentication = true
107 |
108 | # When false, Devise will not attempt to reload routes on eager load.
109 | # This can reduce the time taken to boot the app but if your application
110 | # requires the Devise mappings to be loaded during boot time the application
111 | # won't boot properly.
112 | # config.reload_routes = true
113 |
114 | # ==> Configuration for :database_authenticatable
115 | # For bcrypt, this is the cost for hashing the password and defaults to 12. If
116 | # using other algorithms, it sets how many times you want the password to be hashed.
117 | # The number of stretches used for generating the hashed password are stored
118 | # with the hashed password. This allows you to change the stretches without
119 | # invalidating existing passwords.
120 | #
121 | # Limiting the stretches to just one in testing will increase the performance of
122 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
123 | # a value less than 10 in other environments. Note that, for bcrypt (the default
124 | # algorithm), the cost increases exponentially with the number of stretches (e.g.
125 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
126 | config.stretches = Rails.env.test? ? 1 : 12
127 |
128 | # Set up a pepper to generate the hashed password.
129 | # config.pepper = 'c2bd16bc8a05157f522b28cf2ee7dc214e19b9495de6ba64f170a9fe9361726a4d05fe9d4b7d5f61c3aca65e3f9ac20f6eae4717b470509a08fdcaa819c0b145'
130 |
131 | # Send a notification to the original email when the user's email is changed.
132 | # config.send_email_changed_notification = false
133 |
134 | # Send a notification email when the user's password is changed.
135 | # config.send_password_change_notification = false
136 |
137 | # ==> Configuration for :confirmable
138 | # A period that the user is allowed to access the website even without
139 | # confirming their account. For instance, if set to 2.days, the user will be
140 | # able to access the website for two days without confirming their account,
141 | # access will be blocked just in the third day.
142 | # You can also set it to nil, which will allow the user to access the website
143 | # without confirming their account.
144 | # Default is 0.days, meaning the user cannot access the website without
145 | # confirming their account.
146 | # config.allow_unconfirmed_access_for = 2.days
147 |
148 | # A period that the user is allowed to confirm their account before their
149 | # token becomes invalid. For example, if set to 3.days, the user can confirm
150 | # their account within 3 days after the mail was sent, but on the fourth day
151 | # their account can't be confirmed with the token any more.
152 | # Default is nil, meaning there is no restriction on how long a user can take
153 | # before confirming their account.
154 | # config.confirm_within = 3.days
155 |
156 | # If true, requires any email changes to be confirmed (exactly the same way as
157 | # initial account confirmation) to be applied. Requires additional unconfirmed_email
158 | # db field (see migrations). Until confirmed, new email is stored in
159 | # unconfirmed_email column, and copied to email column on successful confirmation.
160 | config.reconfirmable = true
161 |
162 | # Defines which key will be used when confirming an account
163 | # config.confirmation_keys = [:email]
164 |
165 | # ==> Configuration for :rememberable
166 | # The time the user will be remembered without asking for credentials again.
167 | # config.remember_for = 2.weeks
168 |
169 | # Invalidates all the remember me tokens when the user signs out.
170 | config.expire_all_remember_me_on_sign_out = true
171 |
172 | # If true, extends the user's remember period when remembered via cookie.
173 | # config.extend_remember_period = false
174 |
175 | # Options to be passed to the created cookie. For instance, you can set
176 | # secure: true in order to force SSL only cookies.
177 | # config.rememberable_options = {}
178 |
179 | # ==> Configuration for :validatable
180 | # Range for password length.
181 | config.password_length = 6..128
182 |
183 | # Email regex used to validate email formats. It simply asserts that
184 | # one (and only one) @ exists in the given string. This is mainly
185 | # to give user feedback and not to assert the e-mail validity.
186 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
187 |
188 | # ==> Configuration for :timeoutable
189 | # The time you want to timeout the user session without activity. After this
190 | # time the user will be asked for credentials again. Default is 30 minutes.
191 | # config.timeout_in = 30.minutes
192 |
193 | # ==> Configuration for :lockable
194 | # Defines which strategy will be used to lock an account.
195 | # :failed_attempts = Locks an account after a number of failed attempts to sign in.
196 | # :none = No lock strategy. You should handle locking by yourself.
197 | # config.lock_strategy = :failed_attempts
198 |
199 | # Defines which key will be used when locking and unlocking an account
200 | # config.unlock_keys = [:email]
201 |
202 | # Defines which strategy will be used to unlock an account.
203 | # :email = Sends an unlock link to the user email
204 | # :time = Re-enables login after a certain amount of time (see :unlock_in below)
205 | # :both = Enables both strategies
206 | # :none = No unlock strategy. You should handle unlocking by yourself.
207 | # config.unlock_strategy = :both
208 |
209 | # Number of authentication tries before locking an account if lock_strategy
210 | # is failed attempts.
211 | # config.maximum_attempts = 20
212 |
213 | # Time interval to unlock the account if :time is enabled as unlock_strategy.
214 | # config.unlock_in = 1.hour
215 |
216 | # Warn on the last attempt before the account is locked.
217 | # config.last_attempt_warning = true
218 |
219 | # ==> Configuration for :recoverable
220 | #
221 | # Defines which key will be used when recovering the password for an account
222 | # config.reset_password_keys = [:email]
223 |
224 | # Time interval you can reset your password with a reset password key.
225 | # Don't put a too small interval or your users won't have the time to
226 | # change their passwords.
227 | config.reset_password_within = 6.hours
228 |
229 | # When set to false, does not sign a user in automatically after their password is
230 | # reset. Defaults to true, so a user is signed in automatically after a reset.
231 | # config.sign_in_after_reset_password = true
232 |
233 | # ==> Configuration for :encryptable
234 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
235 | # You can use :sha1, :sha512 or algorithms from others authentication tools as
236 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
237 | # for default behavior) and :restful_authentication_sha1 (then you should set
238 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
239 | #
240 | # Require the `devise-encryptable` gem when using anything other than bcrypt
241 | # config.encryptor = :sha512
242 |
243 | # ==> Scopes configuration
244 | # Turn scoped views on. Before rendering "sessions/new", it will first check for
245 | # "users/sessions/new". It's turned off by default because it's slower if you
246 | # are using only default views.
247 | config.scoped_views = true
248 |
249 | # Configure the default scope given to Warden. By default it's the first
250 | # devise role declared in your routes (usually :user).
251 | # config.default_scope = :user
252 |
253 | # Set this configuration to false if you want /users/sign_out to sign out
254 | # only the current scope. By default, Devise signs out all scopes.
255 | # config.sign_out_all_scopes = true
256 |
257 | # ==> Navigation configuration
258 | # Lists the formats that should be treated as navigational. Formats like
259 | # :html should redirect to the sign in page when the user does not have
260 | # access, but formats like :xml or :json, should return 401.
261 | #
262 | # If you have any extra navigational formats, like :iphone or :mobile, you
263 | # should add them to the navigational formats lists.
264 | #
265 | # The "*/*" below is required to match Internet Explorer requests.
266 | config.navigational_formats = ['*/*', :html, :turbo_stream]
267 |
268 | # The default HTTP method used to sign out a resource. Default is :delete.
269 | config.sign_out_via = :delete
270 |
271 | # ==> OmniAuth
272 | # Add a new OmniAuth provider. Check the wiki for more information on setting
273 | # up on your models and hooks.
274 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
275 |
276 | # ==> Warden configuration
277 | # If you want to use other strategies, that are not supported by Devise, or
278 | # change the failure app, you can configure them inside the config.warden block.
279 | #
280 | # config.warden do |manager|
281 | # manager.intercept_401 = false
282 | # manager.default_strategies(scope: :user).unshift :some_external_strategy
283 | # end
284 |
285 | # ==> Mountable engine configurations
286 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine
287 | # is mountable, there are some extra configurations to be taken into account.
288 | # The following options are available, assuming the engine is mounted as:
289 | #
290 | # mount MyEngine, at: '/my_engine'
291 | #
292 | # The router that invoked `devise_for`, in the example above, would be:
293 | # config.router_name = :my_engine
294 | #
295 | # When using OmniAuth, Devise cannot automatically set OmniAuth path,
296 | # so you need to do it manually. For the users scope, it would be:
297 | # config.omniauth_path_prefix = '/my_engine/users/auth'
298 |
299 | # ==> Hotwire/Turbo configuration
300 | # When using Devise with Hotwire/Turbo, the http status for error responses
301 | # and some redirects must match the following. The default in Devise for existing
302 | # apps is `200 OK` and `302 Found respectively`, but new apps are generated with
303 | # these new defaults that match Hotwire/Turbo behavior.
304 | # Note: These might become the new default in future versions of Devise.
305 | config.responder.error_status = :unprocessable_entity
306 | config.responder.redirect_status = :see_other
307 |
308 | # ==> Configuration for :registerable
309 |
310 | # When set to false, does not sign a user in automatically after their password is
311 | # changed. Defaults to true, so a user is signed in automatically after changing a password.
312 | # config.sign_in_after_change_password = true
313 | end
314 |
--------------------------------------------------------------------------------