Skip to main content

All Questions

0 votes
1 answer
40 views

How do I change the mongoid error message to a custom message?

In my app I am offering the user to 'subscribe' to a topic. I want to be able to show a custom message if they already are subscribed. I have a uniquness validation in my rails model using mongoid. ...
Boenne's user avatar
  • 616
0 votes
2 answers
219 views

how to go to logout path in rails?

I am using rails 7 and When I click on logout it show an error that logout path is not found. Here is my code of routes.rb, session controller and header section for logout: Rails.application.routes....
Afaq Shahid Khan's user avatar
0 votes
1 answer
171 views

My Ruby on Rails active record validation error does not persist when I re-render the same view

I'm using Rails 7 and Carrierwave to upload images. My image uploading is working as expected, but my issue is happening when I try to implement validation error message for an incorrect file type. In ...
Tony M's user avatar
  • 341
3 votes
0 answers
935 views

What is causing the 'Alias parsing was not enabled' error in Psych while upgrading Rails to 6.0.6.1 and how can it be resolved?

Alias parsing was not enabled getting psych error when upgrading rails from 5.2 to 6.0.6.1 .rvm/gems/ruby-2.7.8@reports2/gems/psych-5.1.0/lib/psych/visitors/to_ruby.rb:432:in `visit_Psych_Nodes_Alias':...
AMAN SHARMA's user avatar
2 votes
0 answers
272 views

Handler for <turbo-frame>-related errors that displays custom error messages

I'm using Rails 7 and am thinking of implementing a handler for turbo frame-related errors that displays custom error messages. For example, I would like to display An error occurred, try later ...
Backo's user avatar
  • 18.7k
0 votes
1 answer
167 views

How can I render a ruby on rails .erb template if something being fetched from an external api returns a 500?

I have an admin page where I can change a users email template. Right now MailChimp/Mandrill is having outages and it is crashing my app. This is the line that crashes the page, when I comment it out ...
PhilCowan's user avatar
  • 533
0 votes
1 answer
548 views

How can I get a more specific 400 validation error instead of a 500 error when using params.require?

I'm working through a full-stack project using Rails on the back end and React on the front end. I have a Sign Up form designed to accept a new user's information and avatar and pass it to the Users ...
CodingNewbie's user avatar
0 votes
1 answer
233 views

Error is attached to wrong input field when a form object involves two models with the same attribute name

I'm working on a form object that involves updating a User record with it's many associated models like Address and Phone via nested attributes. Both Address and Phone models have a number attribute, ...
pinkfloyd90's user avatar
0 votes
1 answer
137 views

Flash message not being displayed while handling errors from ActionController

I am trying to display flash message while handling errors from ActionController with the following code: class ActionController < ApplicationController def action begin @results =...
Nick Chen's user avatar
0 votes
0 answers
339 views

Sign up feature throwing a 422 unprocessable entity error even though username and password are valid

I'm trying to create a sign up feature for my application but anytime I put a username and password that's valid it returns a 422 unprocessable entity error. When I use postman it works fine, I am ...
angiem103's user avatar
0 votes
0 answers
184 views

How to render complete Ruby on Rails errors on an API call?

I've built a Ruby on Rails app, with endpoints I can call to get some API responses. I usually render data and errors like this : def my_fn begin #...computing data... response = { #....
gordie's user avatar
  • 1,865
0 votes
2 answers
257 views

Is it possible to customise a existing error/exception in rails?

My controller is catching the following error in a observed case #<ActiveRecord::RecordNotUnique: Mysql2:: Error: Duplicate entry 'xyz1' for key 'abc.xyz': INSERT INTO'abc' (<insert statement ...
Akhil S R's user avatar
1 vote
1 answer
725 views

how to add attributes to custom rails exceptions

Say I have a custom error class that inherits from a parent error class. How can I add an attribute to that class, so something like: class CustomError <CustomParentErrorClass status: 500 end ...
aj soprano's user avatar
0 votes
2 answers
472 views

How to check if date is valid (Ruby on Rails)

I have this before_save function: def set_birth_date return unless pesel_changed? day = pesel[4..5] case pesel[2..3].to_i when 0..19 month = pesel[2..3] year = pesel[0..1]....
Shruikan's user avatar
1 vote
1 answer
768 views

Rails i18n ActiveModel: Translate error message for absence validation

I have this validation in a service class: class Users::Updater include ActiveModel::Validations validates(:frozen_identification_data, absence: { message: 'Identification fields cannot be ...
Libby's user avatar
  • 992

15 30 50 per page
1
2 3 4 5
28