Questions tagged [ruby-on-rails-6]

Ruby on Rails 6 is the latest version of Ruby on Rails, "an open-source web framework that's optimized for programmer happiness and sustainable productivity."

2084 questions
7
votes
4 answers

Get array of next 7 days name from today in ruby

Hi I want to form an array of next 7 days from today, Example: Suppose today is Sunday so result should be ["Sunday","Monday","Tuesday",'Wednesday","Thursday","Friday","Saturday"]
Puja Garg
  • 251
  • 3
  • 11
7
votes
1 answer

Rails 6 how to link subfolders in assets/config/manifest.js

I just upgraded to Rails 6 and followed guides to make this manifest file: //= link_tree ../fonts //= link_tree ../images //= link_directory ../javascripts .js //= link_directory ../stylesheets .css But rails complains that I haven't added assets…
Mirror318
  • 11,875
  • 14
  • 64
  • 106
7
votes
3 answers

Rails 6 Action Mailbox and Gmail Integration How To

Rails 6 comes with Action Mailbox now. The documentation and community do not have great resources on how to integrate various services outside of the most common such as SendGrid. Assuming a person uses Google's Gsuite Gmail: How could they…
karns
  • 5,391
  • 8
  • 35
  • 57
7
votes
2 answers

ActiveStorage::InvariableError in Home#index

Currently I'm trying to display .HEIC images in Rails 6. I'm using ActiveStorage ImageMagic to use variant to display jpg. Basically I'm trying to use mogrify -format jpg myimage.heic In the image to display jpg. I added…
7
votes
3 answers

Active Storage still detects attachement even after validation failure

This is an issue that has been going on for quite some time and to this day, I still have not found the solution. I have seen some similar issues but not quite what I have been experiencing. I have been experiencing Rails Active Storage since it…
Dan
  • 351
  • 1
  • 3
  • 16
7
votes
2 answers

undefined method `spec' for # - Rails 6 schema:load

We are in the middle of upgrading our rails app from 5.2 to 6.0.1, and now whenever we run db:schema:load --trace we get the following error. ** Invoke db:schema:load (first_time) ** Invoke db:load_config (first_time) ** Invoke environment…
7
votes
0 answers

Rails ActionText: Disable Direct Upload

Is there a way to disable direct upload of images and attachments from the ActionText/Trix Editor and replace it with a POST request to the rails backend to do the upload to S3? I'm trying to do this to audit any user upload actions from Rails…
konyak
  • 10,818
  • 4
  • 59
  • 65
7
votes
1 answer

Rails 6 webpack throwing 'Uncaught ReferenceError: $ is not defined'

Hi i recently started working on Rails 6 with ruby 2.6.5. as the rails 6 has introduced the webpacks so i am trying to load my js files with the webpack. Although i have already required the jquery in the appliation.js still i am getting the below…
awsm sid
  • 595
  • 11
  • 28
7
votes
0 answers

"Error while fetching an original source" in new rails app (Sprockets 4, Firefox 70)

It seems sprockets 4.0.0 is compatible with Chrome 78, but not Firefox 70. Starting with a new rails app: rails -v # Rails 6.0.0 rails new helloworld # Gemfile gem 'sass-rails', '~> 6' # not 5 bundle | grep sprockets Using sprockets 4.0.0 Using…
Jared Beck
  • 16,796
  • 9
  • 72
  • 97
7
votes
3 answers

Rails 6 Active Storage : Could not find or build blob: expected attachable, got nil

Just created a new Rails 6 app, and I am trying to allow adding images to an active_storage blob instead of replacing them, through a form generated with rails scaffold. Followed the documentation…
Simon Mo
  • 503
  • 2
  • 4
  • 14
7
votes
1 answer

Why am I seeing `SET xmloption = content;` in my structure.sql?

I'm using Rails 6 and recently wrote a small migration to add a column to a table. Simple stuff: class AddInstagramUsernameToUsers < ActiveRecord::Migration[6.0] def change add_column :users, :instagram_username, :string end end But noticed…
Glyoko
  • 2,071
  • 1
  • 14
  • 28
7
votes
1 answer

Using constant as keys in ruby hash

Assuming I have 2 strings constants KEY1 = "Hello" KEY2 = "World" I would like to create a hash using these constants as key values. Trying something like this: stories = { KEY1: { title: "The epic run" }, KEY2: { title: "The epic fail"…
Maxim Veksler
  • 29,272
  • 38
  • 131
  • 151
7
votes
1 answer

How to get all the associated models from ActiveRecord object?

For example I have class Order < ActiveRecord::Base has_many :shippings has_one :contact_information belongs_to :shop end How to get an array of associated objects from Order. For example Order.associations # [:shipping,…
6
votes
1 answer

Parallel testing in rails 6 and rspec

I am trying to make parallel tests using rspec and rails 6. According to their documentation, it is just required to add PARALLEL_WORKERS=15 where 15 is the number of workers. However, this works for Testcases and not for rspecs. Have anybody found…
6
votes
1 answer

Zeitwerk "DEPRECATION WARNING: Initialization autoloaded the constants" caused by including a module in the lib folder

DEPRECATION WARNING: Initialization autoloaded the constants AuthHelper, SemanticFormHelper, ActionText::ContentHelper, and ActionText::TagHelper Since upgrading to Rails 6 I have been getting this warning relating to the new Zeitwerk…
markv12
  • 334
  • 1
  • 11