Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Browsing all 4622 articles
Browse latest View live

Nanoc is not compiling css

I wanted to use custom stylesheet path /stylesheets/stylesheet.css to use with nanoc but nanoc doesn't render css file in output folder. Here are my rules:compile '/stylesheets/' do filter...

View Article


nanoc and multiple layouts

is it possible to use multiple layouts for a specific (or all) item(s)?For example, I have a couple of items, and I want to apply two different layouts to it. One with a green and one with a blue...

View Article


Run rake task in controller

I'd like to run a rake task in my controller. Is there any way to do this?

View Article

Merge items in nanoc

I have been trying to use nanoc for generating a static website. I need to organize a complex arrangement pages I want to keep my content DRY.How does the concept of includes or merges work within the...

View Article

Cucumber feature file: How can I pass variables in a data table

Is there a way I can pass variables defined in a previous step, in the data table of a feature file?I have a scenario with:Then database content is | serviceName | timesSet | | a_random_service_1 | [0,...

View Article


What is a Ruby gem?

I've searched on Google, and I just found the uses of gem. As in, gem install, etc.Are gems collections of .rb scripts?If I build a series of scripts, for example that wraps the functionality of Google...

View Article

How to decode an "=?UTF-8?B?…" string in Ruby

I am working with the Mandrill Inbound Email API, and when an email has an attachment with one or more spaces in its file name, then the file name is encoded in a format that I do not know how to...

View Article

Switch ruby version on Mac M1

I would like to switch Ruby versions on my Mac M1. My understanding is that Mac comes with a preinstalled version of Ruby (in my case, when I run ruby -v I get:ruby 2.6.10p210 (2022-04-12 revision...

View Article


How do people at Ruby think they will get away from static members? (Also:...

I was on #ruby on Freenode getting some real advice on how Ruby is different from Java yesterday, when someone pointed out that Ruby has no static members. I was really surprised.Can anyone tell me...

View Article


Getting bootsnap error when using 3.3.1 ruby versions

I am updating ruby version from 3.0.6 to 3.3.1 and bundle run successfully but when try to run rails server or rails c ,getting this error**"**ArgumentError: comparison of String with nil failed...

View Article

How to send Rails parent/child to front end JS so it's accessible as a nested...

In backend, my object relationship is that an Itemhas_manyOptions. I'd like to be able to access all the attributes on the item and its child options as a hash in the front end:items = [ { id: 1,...

View Article

Prepend output while streaming like foreman

I have this ruby script that I use quite often:$stdin.each_line do |it| it.strip! eval(ARGV.first)endFor instance:> dir | each "Dir.chdir(it) { puts it; system('bundle') }"codeBundle complete! 41...

View Article

How to generate a random string in Ruby

I'm currently generating an 8-character pseudo-random uppercase string for "A" .. "Z":value = ""; 8.times{value << (65 + rand(25)).chr}but it doesn't look clean, and it can't be passed as an...

View Article


form_tag not triggering patch call in rails

Below is the code to update the statuses for different students but the issue is after I am made some changes to the statues clicking update status does nothing.students/manage_users.html.erb<div...

View Article

How can I install cocoapods without getting an error?

I successfully installed latest version of Ruby 3.3.1:Successfully installed ruby 3.3.1 into /Users/sampleUser/.rubies/ruby-3.3.1But I am still getting the following error when I try to install...

View Article


Error Division Zero when hit endoint with rspec rails

I have some test with rspec, but when i run that test, appear error division zero like images below, can someone help me?This my codeThis my result when i run rspecthere is no error code in controller...

View Article

Always save using writable database

I have a rails app which connects to a primary database and its replica, i.e. ApplicationRecord saysconnects_to database: {writing: :primary, reading: :primary_replica}Is there any reason I shouldn't...

View Article


Rails 7.1: "whenever" gem seems to create a cron job, but it is not displayed...

I have a Rails 7.1 app and I want to use the whenever gem for generating cron jobs.This is my schedule.rb:set :environment, ENV['RAILS_ENV']set :output, 'log/whenever.log'every 1.day, at: '1:00 pm' do...

View Article

Get hostname of URL in ruby on rails

I am making rails app and I need to get just hostname of my URL from my one of Rails controllers.If my URL is http://www.example.com/path/0,then I just want to extract www.example.com part. How can I...

View Article

Error running '__rvm_make install' on macOS Monterey

I am trying to install ruby 2.7.0 version on mac(12.2.1) using rvm but getting below error, and tried all the solution possible on github nothing seems to work. Even tried using rbenv but same error....

View Article
Browsing all 4622 articles
Browse latest View live