Category "ruby"

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

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

profile.assume_untrusted_certificate_issuer = false not working for me

Using watir-webdriver for automation I'm not able to handle Firefox "Untrusted Connection" . Already tried this: require 'watir-webdriver' profile = Selenium

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

Error while installing pod in Apple Silicon (M1)

Command i am running is brew install cocoapods Warning: cocoapods 1.11.2_2 is already installed and up-to-date. To reinstall 1.11.2_2, run: brew reinstall

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

yast2 is broken after executing `zypper update`

I am a newer to use openSUSE. Recently I execute zypper update and found yast2 UI client cannot be launched. I can see the log in /var/log/YaST2/y2log: 2020-03

Ruby: checking if a string can be converted to an integer [duplicate]

Possible Duplicate:Test if a string is basically an integer in quotes using Ruby? "1" "one" The first string is a number, and I ca

Ruby return statement does not work with super keyword?

class Parent def test return end end class Child < Parent def test super p "HOW IS THIS POSSIBLE?!" end end c = Child.new c.test I th

Navigate to Ruby function definition in VS Code

I'm pretty new to Visual Studio Code, and I'm trying to edit some Ruby code. I installed Ruby support, and I enabled the language server, but Ctrl-clicking on a

Convert Hash to OpenStruct recursively

Given I have this hash: h = { a: 'a', b: 'b', c: { d: 'd', e: 'e'} } And I convert to OpenStruct: o = OpenStruct.new(h) => #<OpenStruct a="a", b="b"

is there a way to set after_commit callbacks to a specific ActiveRecord transaction

I am creating a ActiveRecord transaction this way ActiveRecord::Base.transaction do MyModel.create!(name: "value") OtherModel.create!(name: "value") end

Bundler could not find compatible versions for gem "bundler":

Complete new person to Ruby and Rails here... Have tried some tutorials in the past, but that's about it. I'm trying to follow 'Ruby on Rails 3 Tutorial' book

Failed to build gem native extension: Unable to install Rails + MySQL2

I am on MAC OS X LION and keep getting error message Failed to build gem native extension when trying to install rails and mysql. This is what I am doing. I en

How do I dynamically add my Ngrok tunnel to config.hosts in Rails 6?

I'm trying to whitelist my ngrok tunnel hostname in config.hosts but it changes every time I start Ngrok. Is there a way to get the public url of my Ngrok tunne

How to detect if two images are the same with different cropping ratios?

I have two different images with different dimensions: 100px and 400px As you can see the two are clearly the "same" from a human point of view. Now I wanna

Other Ruby Map Shorthand Notation

I am aware of the shorthand for map that looks like: [1, 2, 3, 4].map(&:to_s) > ["1", "2", "3", "4"] I was told this is shorthand for: [1, 2, 3, 4].m

Use if statement in layout.html.erb in a Sinatra app

Within my Sinatra application I would like to serve a minified version of my css/js for production but in development keep my default setup (individual files).

-bash: /Users/myname/.bash_profile: Permission denied

I installed rvm (ruby version manager) and it was success, but I got WARNING: You have '~/.profile' file, you might want to load it, to do that add the fo

What is the send() method used for?

Could someone please help me to understand what the 'send()' method listed below is used for? The code below, when I am reading it, makes no sense what purpose