Questions tagged [ruby-on-rails-5.2]

For issues specific to the version 5.2 of Rails. If your question applies to Ruby on Rails in general, use the tag [ruby-on-rails].

Ruby on Rails 5.2, "an open-source web framework that's optimized for programmer happiness and sustainable productivity." Rails 5.2 brings a bunch of new features and improvements over older Rails versions.

Major Features

  • Active Storage
  • Redis Cache Store
  • HTTP/2 Early Hints
  • Credentials

See Ruby on Rails 5.2 Release Notes for more information.

Resources

Related tags

538 questions
6
votes
1 answer

How to handle ActiveSupport::MessageVerifier::InvalidSignature errors for ActiveStorage direct uploads

I have a form where a user selects a file to upload. The file is uploaded once the file is selected using ActiveStorage direct uploads. There is a submit button that is not clickable until the upload is complete. The button is disabled when the…
chell
  • 7,064
  • 15
  • 67
  • 129
6
votes
0 answers

jsonapi-resources custom action

I need to add a custom action to my jsonapi-resources controller. This action just creates e new version of a preexistent CollectorContent model instance. My implementation (just copied from here): routes.rb jsonapi_resources :collector_contents…
masciugo
  • 1,033
  • 11
  • 18
6
votes
1 answer

Rails ActiveStorage - accessing through Rails console

ActiveStorage creates 2 tables active_storage_blobs and active_storage_attachments. I wonder if there is a way to access them easily through Rails console (i.e. schema migration internal table can be accessed by ActiveRecord::SchemaMigration)?
alexs333
  • 10,543
  • 9
  • 46
  • 82
6
votes
0 answers

How to import vendor assets to webpacker?

I have added few javascript and css libraries to the vendor/stylesheets and vendor/javascript directories. I am not able to import those in my app/javascript/packs/application.js. I am using webpacker as my asset pipeline.
6
votes
2 answers

Multiple upload images in active_admin with Active Storage

I found useful article about uploading image using Active Storage in activeadmin: https://medium.com/@maris.cilitis/using-ruby-on-rails-active-storage-image-uploads-for-active-admin-backed-resources-5638a9ca0b46 But how to upload multiple images in…
6
votes
1 answer

ActiveStorage get dirty object stating if an image as changed

I would like to know if an image has changed on an ActiveRecord model object so I can perform other functions but don't see anything available to know this. I.E. object.image.changed? or object.image_changed? or object.changed?
John Pollard
  • 2,989
  • 2
  • 21
  • 40
6
votes
1 answer

How can I `git diff` changes to rails 5.2 credentials?

I want to be able to diff the changes to my encrypted config/credentials.yml.enc. git diff alone shows the difference to the encrypted file contents. I want to see the plaintext changes. How can I get a human readable diff of the…
tommarshall
  • 1,838
  • 3
  • 20
  • 34
6
votes
1 answer

Rails 5.2 Active Storage direct upload failure: CORS header ‘Access-Control-Allow-Origin’ missing

I am trying out Rail 5.2.0.rc1 Active Storage, using its included JavaScript library to upload PDF docs directly from the client to the cloud. But on submitting a form I get a browser error in both Firefox & Chrome: Cross-Origin Request Blocked...…
KeithP
  • 1,653
  • 12
  • 23
5
votes
1 answer

ActionController::UnknownFormat when add respond_to

When I remove respond_to and render to view, everything works fine but adding the js render gives an error. controller code : if params[:stock].present? @data = params[:stock] @stock = Stock.new_form_lookup(params[:stock]) respond_to do |…
AlmoDev
  • 807
  • 1
  • 14
  • 35
5
votes
1 answer

Use a single form_with to create and edit nested resources in Rails

Background Inside of my application, a series is composed of many books. A series' Show page allows a user to see all the books in a series and to add a new book to the series using a form. Every book listed on the Show page has a link to an Edit…
5
votes
4 answers

Difference between update and update_attributes

In Rails 5, what is the difference between update and update_attributes methods. I'm seeing the following results for both the methods Returns true/false Checking for active record validation Call backs are triggered and also regarding update…
Sam
  • 4,294
  • 9
  • 35
  • 77
5
votes
2 answers

Swagger documentation tools for a Rails API application

I googled a little bit to find a proper and easy to implement way to generate Swagger documentation for an existing Rails API app. To be short, there are 2 ways of implementation: either via controllers, models or via Rspec controller/request specs.…
belgoros
  • 2,671
  • 3
  • 19
  • 49
5
votes
1 answer

How to configure Rails 5.2.1 server listen on all interfaces?

I'm still fairly new to RoR and learning so please bear with me if I have follow-up questions. Our Rails (v 5.0.2) app was configured to listen on all interfaces with this configuration in config/boot.rb: require 'rails/commands/server' module…
aumn26
  • 51
  • 1
  • 4
5
votes
1 answer

How to disable auto generated routes by Active Storage

I am upgrading an existing application to Rails 5.2. Old application is using Paperclip for file storage and I am trying to move that to ActiveStorage. My app expose an API that allows users to securely upload files (using key/secret pairs to sign…
Eduard
  • 3,068
  • 1
  • 17
  • 25
5
votes
2 answers

When is ActiveStorage::IntegrityError raised?

My app (locally) raises ActiveStorage::IntegrityError error, whenever it tries to attach a file. How can I get out of this error? I have only one has_one_attached and I don't know how that error gets in the way. # model has_one_attached…
kangkyu
  • 3,226
  • 1
  • 23
  • 32
1 2
3
35 36