Category "ruby-on-rails"

Rails Active Storage: How to create "named variants" that are cropped by user-supplied coordinates

I have something like: class User < ApplicationRecord has_one_attached :avatar do |attachable| attachable.variant :large, resize_to_limit: [300, nil]

Mongo::Error::UnsupportedFeatures (Server at (localhost:27017) reports wire version (2), but this version of the Ruby driver requires at least (6).)

I'm trying to upgrade Mongoid in an Rails 4.2 app from 4.x to 5.x (5.4.1) to connect to a MongoDB 2.6. I've updated the mongoid.yml file to match the difference

Javascript doesn't Run Without Refresh After Submitting Form Using Turbolinks

I have some javascript that puts click handlers on buttons (for instance). Since those buttons don't exist when the user first visits the app at, say, the "Home

Is Ruby on Rails getting started guide up to date?

I'm trying to learn ruby on rails from the official website guide, and I copy paste almost all code but some seems not working. like this on for exemple, I get

Rails gem strong_migrations preventing schema from loading

I've recently tried added the strong_migrations gem to my project, but it's preventing me from running any tests because all of the tables in my schema have the

Ferrum mouse.up doesn't work for click & drag method

I'm writing a test which runs over Cuprite::Ferrum, where I need to click, drag and drop an element below another element on the page. Which works fine while I

Rails 7 Ruby 3.1 LoadError: cannot load such file -- net/smtp

I upgraded to Rails 7 and Ruby 3.1. While trying to run tests with rspec I got the error below. How can I fix it? An error occurred while loading rails_helper.

undefined method `map' for #<ActionController::Parameters Rails 6.0

Getting this error when trying to call the method validate_create_action. The error occurs on the line @element = klass.new(params[:element]

Rspec test fails while rendering

For my user controller, while running the test cases I am facing render issue. It is redirecting to http://test.host/sign_in instead of rendering new. Controlle

Use Rails 6 I18n translations for custom/user-specific naming schemas

What I would like to do is utilize the I18n localization structure to handle organziation-specific naming schemas, independently of the users actual local. Some

Spliting a table column in 2

I have a this column : t.geography "longlat", limit: {:srid=>4326, :type=>"st_point", :geographic=>true} So basically im trying to work with postgis m

Rails ActiveStorage attachment host not working with Postman

I have a problem with getting attachments urls with ActiveStorage, using rails 6.1.4.6 and ruby 2.6.6 In my development.rb I did set routes.default_url_options[

Ngrok - Action Mailbox send me a 403 Forbidden

I want to receive and parse emails from my Rails application using Action Mailbox. In local, everything works fine. I then wanted to try sending email from my G

Gem::Ext::BuildError: ERROR: Failed to build gem native extension - rbnacl-libsodium 1.0.16

I was trying bundle install and my gem file has gem 'rbnacl-libsodium' it took some time for installation and got failed. Using rbnacl 4.0.2 Fetching rbnacl-lib

How to recognize Id attribute in rails form_tag?

I am using a form in rails to pass an id. That id will trigger the javascript Sweet Alert function which will pop up a modal with a confirmation message. When t

rails tutorial Test errors that occur after Chapter 6

I'm a beginner. rails tutorial I got an error like this when I did a rails test after finishing Chapter 6 and before giving it to git. I did an integration test

getting most liked posts by users using act as votable gem rails

I want to display the top 10 users whose posts got the most likes in past 2 hours, how can I do that inquest index to get user <%@users.each do |user| %>

Error: Unable to load application: NameError: undefined local variable or method `controller_path' for Object:Class - When pushing to Heroku

beginner here learning how to push a project to production. I am pushing my ReactJS app that has a server side and client side to Heroku and have the following

Rails 7.0.4 Error when in run some code of ruby on rails

no implicit conversion of Hash into String class PostsController < ApplicationController @posts = Post.all respond_to do |format| format.html forma

Setting up comfy cms fails with multi-tenancy app

I've got an app for which I'd like to use the comfy cms. I did the following: added gem "comfortable_mexican_sofa", "~> 2.0.0" bundle install rails g comfy:c