Category "ruby-on-rails"

Namespacing service objects in Rails 6 with Zeitwerk autoloader

Rails 6 switched to Zeitwerk as the default autoloader. Zeitwerk will load all files in the /app folder, eliminating the need for namespacing. That means, a Tes

Multiple route aliases in Rails 4

I have a Rails 4 application with some routes: resources :users resources :notifications resources :comments ... My client asked me to have urls in english a

heroku rails build fails with crazy error... possibly node issue?

I have an app that I haven't updated in like a year or so, today I make 1 tiny change, doesn't break anything, but when pushing to master I got a lot of stuff..

Can't see reason for Compiling… Compilation failed: (Executor::NonZeroExitStatus)

Deploying on beanstalk. Using rails with webpacker. Compiling… Compilation failed: (Executor::NonZeroExitStatus) We can't seem to get anymore in

Rails authentication strategy

Hope this is not too broad but after a lot of googling I am not sure where to start. I am looking for a introductory/noob overview to help me get started on bui

Running migrations with Rails in a Docker container with multiple container instances

I've seen lots of examples of making Docker containers for Rails applications. Typically they run a rails server and have a CMD that runs migrations/setup then

Rails 4 stylesheet_link_tag sometimes uses relative paths?

I have this weird problem, where sometimes, stylesheet_link_tag links to the relative path to the wrong path? The exact same code works whenever I try to debug

How do I add an uncountable inflection for a non-word character in Rails

In a Rails app I have a number of measurements to display in a human readable form that include both a value and units. Sometimes the units string needs to be

Rails action Mailer raise_delivery_errors, how does it works? How to detect bounces?

I have a Rails 4.2.0 application which sends lots of mails, it's a elearning platfrom. At the moment I have problems with bounces, Lots of the Mails coming bac

Errno::EACCESS: Permission denied @ dir_s_mkdir

I am pretty new to Ruby.. was following the instructions on TeamTreehouse installing Ruby Development Environment on OSX (Yosemite). When I got to the step to

Testing login flow with RSpec in Rails app

I'm using RSpec to test controller behavior in rails. One of the expectations I have is the following scenario: User attempts to access a protected (requires l

Testing associations with rspec: Category does not have a post_id foreign key

I'm trying to test some associations with RSpec but I get these failures: Category Failure/Error: it {should belong_to :post} Expected Category to have

Rails: make authentication to swagger API via devise or other

My goal is log in to Swagger API to get access to endpoints. With auth token in future. I tryed to put Devise line in ApplicationController: before_action :au

GroupingError: ERROR: column " " must appear in the GROUP BY clause or be used in an aggregate function

I am trying to create a list of unique patients who have left comments. The code words fine until I upload to heroku where it doesnt work in postgresql. This

ruby-build: definition not found: 2.2.1

I want to install new version of ruby by rbenv install 2.2.1, but I get the error ruby-build: definition not found: 2.2.1 The following versions contain 2.2.

Adding scope to get objects in reverse order of their created time in rails

I'm new to Ruby on rails and programming. I am working on a exercise where I have a Post model,and I need to add a new scope to it to retrieve its objects in re

Rails log too verbose

How can I prevent Rails to log too much? Here is a typical trace in my production.log file, many partials, cache hits... It's useful in development but I don't

Rails Routes :shallow => true

Wondering why my /articles route is not coming up when I apply :shallow => true? routes.rb resources :users, :shallow => true do resources :articles e

How to replace " into space or delete first and last symbol?

I get xml data and I get value from it. I need to delete symbols [ and ] Here is my code, that gives me error about undegined variable: @xml = XmlSim

Application.js not compiling after upgrading to Rails 7 on heroku with esbuild

I updated my app on Heroku from Rails 6 with Webpacker to Rails 7 with esbuild. The error I receive on production is as follows: The asset "application.js" is n