mercredi 28 juillet 2021

Semantic Logger Contextual Logging

I'm using rails_semantic_gem gem in ruby in order to write logs on a different thread to save time.

Before the change I used ContextManager to save some data on each request the server received in the thread context.

Now that I'm using Semantic Logger I can't access those parameters to add them to my logs.

Is there a way around it?

mardi 27 juillet 2021

Error globalize when upgrade version ruby

Please help me, in a rails project i was tasked with upgrading ruby ​​version from 2.3.1 to 2.4.10 I researched and tried updating every gem, but that seemed to take time and I used bundle update --conservative . When all looks good then I try to run rails s, it throws the following error:

/home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:84:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'dpoint_web'. (Bundler::GemRequireError)
Gem Load Error is: This monkeypatch's lifetime is over. Check Globalize version.
Backtrace for gem load error is:
/home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/dpoint_web-4.3.0.1/lib/globalize_ext/migrator.rb:14:in `<top (required)>'
/home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `require'
/home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `block in require'
/home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `require'
/home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/dpoint_web-4.3.0.1/lib/dpoint_web.rb:11:in `<top (required)>'
/home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:81:in `require'
/home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:81:in `block (2 levels) in require'
/home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:76:in `each'
/home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:76:in `block in require'
/home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:65:in `each'
/home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:65:in `require'
/home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler.rb:114:in `require'
/home/nguyen.quoc.vietb/Desktop/Project/xxx/config/application.rb:12:in `<top (required)>'
/home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/railties-4.2.11.1/lib/rails/commands/commands_tasks.rb:78:in `require'
/home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/railties-4.2.11.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
/home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/railties-4.2.11.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
/home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/railties-4.2.11.1/lib/rails/commands/commands_tasks.rb:75:in `server'
/home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/railties-4.2.11.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
/home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/railties-4.2.11.1/lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Bundler Error Backtrace:
    from /home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:80:in `block (2 levels) in require'
    from /home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:76:in `each'
    from /home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:76:in `block in require'
    from /home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:65:in `each'
    from /home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:65:in `require'
    from /home/nguyen.quoc.vietb/.rvm/rubies/ruby-2.4.10/lib/ruby/site_ruby/2.4.0/bundler.rb:114:in `require'
    from /home/nguyen.quoc.vietb/Desktop/Project/xxx/config/application.rb:12:in `<top (required)>'
    from /home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/railties-4.2.11.1/lib/rails/commands/commands_tasks.rb:78:in `require'
    from /home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/railties-4.2.11.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from /home/nguyen.quoc.vietb/Desktop/Projectxxx/vendor/bundle/ruby/2.4.0/gems/railties-4.2.11.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/railties-4.2.11.1/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/railties-4.2.11.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/nguyen.quoc.vietb/Desktop/Project/xxx/vendor/bundle/ruby/2.4.0/gems/railties-4.2.11.1/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

I tried updating to the latest version of globalize but it still doesn't work. Help me please!

How to correctly apply CSS styles to HTML element Clearance templates? (Ruby On Rails)

I'm using bootstrap 5 for fastest applying styles, but when I trying to apply styles for HTML element template, I have this:

Before applying

After applying

Code (.html.erb):

<div class="submit-field">
  <button type="button" class="btn btn-primary"><%= form.submit %></button>
</div>

Under <%= form.submit%> hides as I understand a simple button template, but I can not find the source code of this template in any way, as if it works "out of thin air". Maybe there is a way how to find it or correctly apply CSS?

vendredi 23 juillet 2021

How can I only use an HTML layer on a specific Ruby on Rails page?

There is an HTML layer made with the Clearance plugin that redirects to the registration page, but it is used by default on all pages. How do I make it so that it only appears on one page?

Screenshot1 Screenshot2

mercredi 21 juillet 2021

Letting link bold when is clicked on Ruby

I am working on this .erb file and I have a method that returns a map with links. What I want here is to let the link bold when you click on it. So the web page will be something like that:

A | B | C | D

and if I click on D will send me to that path and D will be bold

A | B | C | D

<%= template.myMethod.map{|link| "|#{link}"}.join("")%>

Thank you

samedi 17 juillet 2021

I can't execute rspec using 'bundle exec rspec'

I'm very new to coding and I have been learning ruby through the app academy open bootcamp. I have gotten to the Rspec topic, but after installing the gems from the gem file provided in the course:

source "https://rubygems.org"

gem "byebug"
gem "rspec", "~> 3.2.0"

The next step was to run Rspec using bundle exec rspec and I keep getting this error

from C:/Users/USER/Desktop/App Academy/rspec_demo/spec/add_spec.rb:1:in `require'
        from C:/Users/USER/Desktop/App Academy/rspec_demo/spec/add_spec.rb:1:in `<top (required)>'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `load'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `block in load_spec_files'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `each'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `load_spec_files'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:97:in `setup'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:85:in `run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in `run'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:in `invoke'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.2.3/exe/rspec:4:in `<top (required)>'
        from C:/Ruby30-x64/bin/rspec:23:in `load'
        from C:/Ruby30-x64/bin/rspec:23:in `<main>'

I'm using windows 10 ruby version 3.0.2p107 (2021-07-07 revision 0db68f0233) rails version 6.1.4 gem version 3.2.22

I have tried uninstalling then reinstalling ruby on rails, and reinstalling the gem files. I have tried Googling the solution but I can not find a single solution for my specific problem. Any help will be appreciated!

vendredi 16 juillet 2021

Where is passenger_max_request_queue_size located in phusion passenger

I am getting the below error message

The website is under heavy load

There are solutions but I don't understand where to change the below parameter in passenger-config.

passenger_max_request_queue_size

Please help to find the file location.

I have passenger + Nginx running on my server.

Emailid searching in elastics search

This search fails for emailid as it contains @. How can I solve this? Or can i use wildcard with multimatch?

result = TestIndex::Test
                         .filter(match: { account_id: hotel.account_id })
                         .query(query_string: {
                          query: "*"+query_text+"*",
                          fields: ['first_name', 'last_name', 'phones', 'emails', 'room']
                          })
                         .highlight({ pre_tags: ['<mark>'], post_tags: ['</mark>'],
                                      number_of_fragments: 0,
                                      fields: {
                                          'first_name': { number_of_fragments: 0 },
                                          'last_name': { number_of_fragments: 0 },
                                          'phones': { number_of_fragments: 0 },
                                          'emails': { number_of_fragments: 0 }
                                      }
                         })
                         .paginate(page: page, per_page: page_size).as_json
    

lundi 12 juillet 2021

Ruby bundle exec s

Building a rails application , everything has been working correctly for the past few weeks, using ruby on rails with a react app as well.

I mis-typed bundle exec rails s with a \ example bundle exec rails s\ and the terminal recognized it as a new line and I just control c out of it, after pushing to git, I ran the program locally again using the above command and I am returned with the error below.

I have tried rails s same error along with bundle exec rails c I have tried to reinstall ruby gems using --force, and npm packages.

I am not even sure where to even start with this error.

I am fairly new to ruby and rails. I do not understand how or where this error started everything was fine prior.

    => Run `bin/rails server --help` for more startup options
Exiting
Traceback (most recent call last):
        56: from bin/rails:4:in `<main>'
        55: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        54: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        53: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        52: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        51: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        50: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/commands.rb:18:in `<main>'
        49: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/command.rb:50:in `invoke'
        48: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/command/base.rb:69:in `perform'
        47: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        46: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        45: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        44: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/commands/server/server_command.rb:135:in `perform'
        43: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/commands/server/server_command.rb:135:in `tap'
        42: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/commands/server/server_command.rb:144:in `block in perform'
        41: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/commands/server/server_command.rb:37:in `start'
        40: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
        39: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
        38: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
        37: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
        36: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
        35: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
        34: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
        33: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
        32: from config.ru:3:in `block in <main>'
        31: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:in `require_relative'
        30: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in `require'
        29: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:299:in `load_dependency'
        28: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in `block in require'
        27: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
        26: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        25: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        24: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        23: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        22: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        21: from /Users/machine5739/Desktop/greenroads-admin/config/environment.rb:5:in `<main>'
        20: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/application.rb:384:in `initialize!'
        19: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:60:in `run_initializers'
        18: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/2.7.0/tsort.rb:205:in `tsort_each'
        17: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/2.7.0/tsort.rb:226:in `tsort_each'
        16: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/2.7.0/tsort.rb:347:in `each_strongly_connected_component'
        15: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/2.7.0/tsort.rb:347:in `call'
        14: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/2.7.0/tsort.rb:347:in `each'
        13: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/2.7.0/tsort.rb:349:in `block in each_strongly_connected_component'
        12: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/2.7.0/tsort.rb:431:in `each_strongly_connected_component_from'
        11: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/2.7.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        10: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/2.7.0/tsort.rb:228:in `block in tsort_each'
         9: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:61:in `block in run_initializers'
         8: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:32:in `run'
         7: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:32:in `instance_exec'
         6: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/webpacker-5.4.0/lib/webpacker/railtie.rb:41:in `block in <class:Engine>'
         5: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/webpacker-5.4.0/lib/webpacker.rb:35:in `bootstrap'
         4: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/webpacker-5.4.0/lib/webpacker/commands.rb:47:in `bootstrap'
         3: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/webpacker-5.4.0/lib/webpacker/manifest.rb:18:in `refresh'
         2: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/webpacker-5.4.0/lib/webpacker/manifest.rb:84:in `load'
         1: from /Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/json-2.5.1/lib/json/common.rb:216:in `parse'
/Users/machine5739/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/json-2.5.1/lib/json/pure/parser.rb:121:in `parse': source is not valid JSON! (JSON::ParserError)

Rails db:setup aborted because wrong number of argument

So I am currently trying to develop this project (https://open.appacademy.io/learn/full-stack-online/javascript/ajax-twitter) but while executing "rails db:setup", I encounter the error of "rails aborted!, ArgumentError: wrong number of arguments (given 3, expected 2)"

rails db:setup --trace 
** Invoke db:setup (first_time)
** Invoke db:schema:load_if_ruby (first_time)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
rails aborted!
ArgumentError: wrong number of arguments (given 3, expected 2)
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/actionpack-5.2.6/lib/action_dispatch/middleware/static.rb:111:in `initialize'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/actionpack-5.2.6/lib/action_dispatch/middleware/stack.rb:37:in `new'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/actionpack-5.2.6/lib/action_dispatch/middleware/stack.rb:37:in `build'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/actionpack-5.2.6/lib/action_dispatch/middleware/stack.rb:101:in `block in build'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/actionpack-5.2.6/lib/action_dispatch/middleware/stack.rb:101:in `each'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/actionpack-5.2.6/lib/action_dispatch/middleware/stack.rb:101:in `inject'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/actionpack-5.2.6/lib/action_dispatch/middleware/stack.rb:101:in `build'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/engine.rb:510:in `block in app'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/engine.rb:506:in `synchronize'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/engine.rb:506:in `app'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/initializable.rb:32:in `instance_exec'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/initializable.rb:32:in `run'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/initializable.rb:61:in `block in run_initializers'
/Users/eduardomeza/.rvm/rubies/ruby-3.0.1/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
/Users/eduardomeza/.rvm/rubies/ruby-3.0.1/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/Users/eduardomeza/.rvm/rubies/ruby-3.0.1/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
/Users/eduardomeza/.rvm/rubies/ruby-3.0.1/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
/Users/eduardomeza/.rvm/rubies/ruby-3.0.1/lib/ruby/3.0.0/tsort.rb:347:in `each'
/Users/eduardomeza/.rvm/rubies/ruby-3.0.1/lib/ruby/3.0.0/tsort.rb:347:in `call'
/Users/eduardomeza/.rvm/rubies/ruby-3.0.1/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
/Users/eduardomeza/.rvm/rubies/ruby-3.0.1/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
/Users/eduardomeza/.rvm/rubies/ruby-3.0.1/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/initializable.rb:60:in `run_initializers'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/application.rb:361:in `initialize!'
/Users/eduardomeza/Downloads/skeleton 13/config/environment.rb:5:in `<main>'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/application.rb:337:in `require_environment!'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/application.rb:520:in `block in run_tasks_blocks'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:243:in `block in invoke_prerequisites'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:241:in `each'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:241:in `invoke_prerequisites'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:243:in `block in invoke_prerequisites'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:241:in `each'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:241:in `invoke_prerequisites'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:243:in `block in invoke_prerequisites'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:241:in `each'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:241:in `invoke_prerequisites'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:243:in `block in invoke_prerequisites'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:241:in `each'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:241:in `invoke_prerequisites'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/command.rb:48:in `invoke'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/railties-5.2.6/lib/rails/commands.rb:18:in `<main>'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Users/eduardomeza/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:setup => db:schema:load_if_ruby => db:create => db:load_config => environment

I am currently using:

  1. "ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [arm64-darwin20]"
  2. "Rails 5.2.6"
  3. ""Postgress.app""
  4. SQLite version 3.32.3 2020-06-18 14:16:19

Gemfile is:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

gem 'bootsnap', require: false
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2'
# Use postgresql as the database for Active Record
gem 'pg', '>= 1.0.0'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'

gem 'jquery-rails'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '~> 2.13'
  gem 'selenium-webdriver'
end

group :development do
  gem 'pry-rails'
  gem 'better_errors'
  gem 'binding_of_caller'
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Project comes with a skeleton and many default files(You can click the link above and check the files since it an open project. The only thing Iam doing different is that I am not using ruby 2.5.1 as they suggest but I doubt that could be the issue. Very new to rails so if anyone can lead me to the right direction, I will really appreciated it. Thank you!

mardi 6 juillet 2021

how can I see the attributes of my object

I've got this line in my code

test = User.first

which gives me back

#<User:0x270e37c>

I know I have attributes on this object like "id" and "login"...when I run the debugger in my ide I can see "@attributes = Hash(17 elements)" and I can see them listed inside as 'id' = "433" and 'login' = "firstname.lastname" etc

@attributes = Hash(17 elements)
'id' = "433"
'login' = "firstname.lastname"
...

How do I return the value of 'id'?

test.attribute.id? <--- gives an error

I know this is simple but I just do not remember. Thanks for you time

UPDATE:

test.attributes["id"] is not the answer. it gives the error...

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.map

samedi 3 juillet 2021

What's an appropriate tech stack for marketplace auction platform

For the last month I've been researching on the subject of developing a marketplace based auction. And was wondering if there are any solutions that are on the market already (such as Sharetribe), or would I better off hire a developer and build it from scratch...

This would be a classic auction, really similar to ebay, where sellers can:

  1. submit a form to create a lot, upload images, choose category, and add description.
  2. choose a time period for how long their item can be sold.
  3. get paid when the lot is sold.

On the other hand, buyers can:

  1. browse items and different categories
  2. bid on an item they like
  3. use an integrated payment gateway to pay for it
  4. watch over the lots they like

So far, I was able to find that Ruby could be a good option for developing this kind of backend. Then started reading about Node.js, and that it could be a good option as well + that way I could use next.js for front-end which is rather cool, since I create design in Figma with a component based approach. I guess I would need a database to store all users data / data on bids and won lots...

So anyways, the question is - how and where do I start... What are some best ways of going around creating this thing?