# Ruby Questions

**URL:** https://metaruby.com/c/ruby-questions/23.md

[Latest](https://metaruby.com/latest.md) · [Categories](https://metaruby.com/categories.md) · [Tags](https://metaruby.com/tags.md)

---

## [About the Ruby Questions category](https://metaruby.com/t/about-the-ruby-questions-category/454)

<div class="topic-metadata">

**Author:** [@AstonJ](https://metaruby.com/u/AstonJ)\
**Replies:** 0

</div>

Stuck with some Ruby code? Ask here!

---

## [Jquery and rails](https://metaruby.com/t/jquery-and-rails/2221)

<div class="topic-metadata">

**Author:** [@merlin2049er](https://metaruby.com/u/merlin2049er)\
**Replies:** 5\
**Last updated:** [April 9, 2019, 1:19pm UTC](https://metaruby.com/t/jquery-and-rails/2221 "2019-04-09T13:19:33Z")

</div>

Hi, I’m confused with why my local (or development environment) works well with Jquery 3.3.1 (I have some dropdown hover jquery events) , but when I build it on Heroku (production), it fails to load Jquery 3.3.1, I git v…

---

## [Ruby on Rails controller redirect not happening from WEBGL](https://metaruby.com/t/ruby-on-rails-controller-redirect-not-happening-from-webgl/2050)

<div class="topic-metadata">

**Author:** [@meta-monkey](https://metaruby.com/u/meta-monkey)\
**Replies:** 0\
**Last updated:** [December 7, 2018, 1:45am UTC](https://metaruby.com/t/ruby-on-rails-controller-redirect-not-happening-from-webgl/2050 "2018-12-07T01:45:59Z")

</div>

My stack overflow post (and bounty!) with the details of the issue is here: It’s a simple email/password login problem, however instead of using standard email/password fields within rails (which does work), I use a W…

---

## [Ruby (EVAL) - Selenium](https://metaruby.com/t/ruby-eval-selenium/1916)

<div class="topic-metadata">

**Author:** [@satish9126](https://metaruby.com/u/satish9126)\
**Replies:** 0\
**Last updated:** [September 12, 2018, 3:34pm UTC](https://metaruby.com/t/ruby-eval-selenium/1916 "2018-09-12T15:34:28Z")

</div>

Hi Iam using page object model in my Selenium -Ruby Automation Framework and trying to use eval so that i can parameterize some value in the code and run them. on("abcpage").certify # code to click on button named cert…

---

## [Error starting Visualruby](https://metaruby.com/t/error-starting-visualruby/1873)

<div class="topic-metadata">

**Author:** [@helado](https://metaruby.com/u/helado)\
**Replies:** 1\
**Last updated:** [August 15, 2018, 8:04pm UTC](https://metaruby.com/t/error-starting-visualruby/1873 "2018-08-15T20:04:59Z")

</div>

Hey, I’m new and want to lern Ruby. so i installed Ruby and ConEmu. and with ruby it works. the next step was to install Visualruby. want to start it with “vr” and i get an error. working with Win 7 x64 Traceback …

---

## [Error: Incompatible Library version](https://metaruby.com/t/error-incompatible-library-version/1857)

<div class="topic-metadata">

**Author:** [@mlevin77](https://metaruby.com/u/mlevin77)\
**Replies:** 2\
**Last updated:** [August 8, 2018, 9:51am UTC](https://metaruby.com/t/error-incompatible-library-version/1857 "2018-08-08T09:51:04Z")

</div>

I’m trying to use Ruby on an Apple running High Sierra. I get this error: 1: from /usr/local/lib/ruby/2.5.0/rubygems/core\_ext/kernel\_require.rb:59:in require' /usr/local/lib/ruby/2.5.0/rubygems/core\_ext/kernel\_require.r…

---

## [How can I use checkboxes to change the value of an attribute?](https://metaruby.com/t/how-can-i-use-checkboxes-to-change-the-value-of-an-attribute/1680)

<div class="topic-metadata">

**Author:** [@Uriel1795](https://metaruby.com/u/Uriel1795)\
**Replies:** 1\
**Last updated:** [May 8, 2018, 6:50pm UTC](https://metaruby.com/t/how-can-i-use-checkboxes-to-change-the-value-of-an-attribute/1680 "2018-05-08T18:50:18Z")

</div>

I am creating a Ruby on Rails application where it searches for certain classes according to their: model, session and year. Moreover, I need a check box to filter which class is being displayed on the screen. The optio…

---

## [Call Mailer from a script RoR](https://metaruby.com/t/call-mailer-from-a-script-ror/1520)

<div class="topic-metadata">

**Author:** [@sakshik](https://metaruby.com/u/sakshik)\
**Replies:** 1\
**Last updated:** [April 1, 2018, 7:25am UTC](https://metaruby.com/t/call-mailer-from-a-script-ror/1520 "2018-04-01T07:25:11Z")

</div>

I have a rails application myrails. I have generated a UserMailer. It created: myrails/app/mailers/user\_mailer.rb placeholder for templates of mails: myrails/app/view/user\_mailer/…’ I wrote an action in user\_mailer.r…

---

## [Change GitHub Project Name?](https://metaruby.com/t/change-github-project-name/1590)

<div class="topic-metadata">

**Author:** [@BurdetteLamar](https://metaruby.com/u/BurdetteLamar)\
**Replies:** 2\
**Last updated:** [March 19, 2018, 12:14pm UTC](https://metaruby.com/t/change-github-project-name/1590 "2018-03-19T12:14:41Z")

</div>

I started a GH project named ‘MarkdownHelper’ and later released it to rugygems.org. Following the convention, I named the gem ‘markdown\_helper’, which means that the project name and gem name are different. (This is o…

---

## [Method Name: Straightforward, or Accurate?](https://metaruby.com/t/method-name-straightforward-or-accurate/1545)

<div class="topic-metadata">

**Author:** [@BurdetteLamar](https://metaruby.com/u/BurdetteLamar)\
**Replies:** 5\
**Last updated:** [March 5, 2018, 3:50am UTC](https://metaruby.com/t/method-name-straightforward-or-accurate/1545 "2018-03-05T03:50:26Z")

</div>

I am working on a Ruby logger. (Yes, yet another logger! But this one is different. Really!). For logging an array (or array-like object), the method could be either Log#put\_array or Log#put\_each\_with\_index. The for…

---

## [How to get latest news from news websites into a webpage?](https://metaruby.com/t/how-to-get-latest-news-from-news-websites-into-a-webpage/1542)

<div class="topic-metadata">

**Author:** [@jora](https://metaruby.com/u/jora)\
**Replies:** 1\
**Last updated:** [February 24, 2018, 12:34am UTC](https://metaruby.com/t/how-to-get-latest-news-from-news-websites-into-a-webpage/1542 "2018-02-24T00:34:49Z")

</div>

How to get latest news from news websites into a webpage?

---

## [How to select distinct fields grouped by one field and concat them in one field with parameter in ruby](https://metaruby.com/t/how-to-select-distinct-fields-grouped-by-one-field-and-concat-them-in-one-field-with-parameter-in-ruby/1533)

<div class="topic-metadata">

**Author:** [@geministars](https://metaruby.com/u/geministars)\
**Replies:** 0\
**Last updated:** [February 18, 2018, 11:04am UTC](https://metaruby.com/t/how-to-select-distinct-fields-grouped-by-one-field-and-concat-them-in-one-field-with-parameter-in-ruby/1533 "2018-02-18T11:04:24Z")

</div>

I have an table that includes these field: table phonebook id user\_id number name added card\_id speeddial updated\_at sms\_group\_name some records have same sms\_group\_name and number, but there is s…

---

## [Trying to understand the 2 dotted notation(or 3 dotted) in Ruby](https://metaruby.com/t/trying-to-understand-the-2-dotted-notation-or-3-dotted-in-ruby/1504)

<div class="topic-metadata">

**Author:** [@marin-cabac](https://metaruby.com/u/marin-cabac)\
**Replies:** 4\
**Last updated:** [February 2, 2018, 2:28pm UTC](https://metaruby.com/t/trying-to-understand-the-2-dotted-notation-or-3-dotted-in-ruby/1504 "2018-02-02T14:28:10Z")

</div>

I have to check if my variable idx is in the range between 0 and 8 (both 0 and 8 should be included) The following comparison works idx\<=8 && idx\>=0 But I would like to use the dotted syntax instead idx === (0…8) - h…

---

## [Contracts in a gem?](https://metaruby.com/t/contracts-in-a-gem/1502)

<div class="topic-metadata">

**Author:** [@BurdetteLamar](https://metaruby.com/u/BurdetteLamar)\
**Replies:** 4\
**Last updated:** [February 2, 2018, 1:10pm UTC](https://metaruby.com/t/contracts-in-a-gem/1502 "2018-02-02T13:10:53Z")

</div>

My experience in developing libraries has taught me to code (very) defensively, and in particular, to detect and respond to errors as early as possible. To that end, I usually use Ruby gem contracts to guard against cal…

---

## [Having issues understanding recursion](https://metaruby.com/t/having-issues-understanding-recursion/1494)

<div class="topic-metadata">

**Author:** [@marin-cabac](https://metaruby.com/u/marin-cabac)\
**Replies:** 9\
**Last updated:** [February 1, 2018, 12:16pm UTC](https://metaruby.com/t/having-issues-understanding-recursion/1494 "2018-02-01T12:16:01Z")

</div>

I would like to puts a question and until I get a certain answer to call recursively the method. Is that possible? Here is how I see this but of course it doesn’t work def myF puts "Please select a position 0 to 9"…

---

## [Error from hitting post http request](https://metaruby.com/t/error-from-hitting-post-http-request/1420)

<div class="topic-metadata">

**Author:** [@saranghae1314](https://metaruby.com/u/saranghae1314)\
**Replies:** 0\
**Last updated:** [December 15, 2017, 2:32am UTC](https://metaruby.com/t/error-from-hitting-post-http-request/1420 "2017-12-15T02:32:18Z")

</div>

I am trying to make a post request but I am getting the following error in the response body: {"err\_type":"Bad Request","err\_message":"invalid character 'v' in literal true (expecting 'r')"} here is the code i have: r…

---

## [Adding huge arrays element wise](https://metaruby.com/t/adding-huge-arrays-element-wise/1411)

<div class="topic-metadata">

**Author:** [@Ohm](https://metaruby.com/u/Ohm)\
**Replies:** 15\
**Last updated:** [December 18, 2017, 6:27pm UTC](https://metaruby.com/t/adding-huge-arrays-element-wise/1411 "2017-12-18T18:27:34Z")

</div>

If you had two huge arrays, say a hundred million elements in each, and you had to add them element wise, how would you go about doing it? So, what I mean is, I have arr1 = \[1, 2, 3, 4, 5\] arr2 = \[5, 4, 3, 2, 1\] and I…

---

## [Understanding why](https://metaruby.com/t/understanding-why/1374)

<div class="topic-metadata">

**Author:** [@castasam123](https://metaruby.com/u/castasam123)\
**Replies:** 1\
**Last updated:** [November 23, 2017, 11:16am UTC](https://metaruby.com/t/understanding-why/1374 "2017-11-23T11:16:54Z")

</div>

In learning ruby the hard way, i am on exercise 6, and in some of the lines he puts puts x puts y puts “I said: #{x}.” puts “I also said: ‘#{y}’.” and when i input that to atom and open the file in powershell, it wi…

---

## [About Array](https://metaruby.com/t/about-array/1350)

<div class="topic-metadata">

**Author:** [@Gerara](https://metaruby.com/u/Gerara)\
**Replies:** 2\
**Last updated:** [November 13, 2017, 8:33am UTC](https://metaruby.com/t/about-array/1350 "2017-11-13T08:33:40Z")

</div>

Hi. First look at my codes please. names = \["Jack", "Nichole", "Emma"\] print "Please write your name:" name = gets.chop if name == names #I've tried this (if name == names\[0,1,2\]) puts "Correct user!" else put…

---

## [Delete every other item in the array until only one is left](https://metaruby.com/t/delete-every-other-item-in-the-array-until-only-one-is-left/1321)

<div class="topic-metadata">

**Author:** [@marin-cabac](https://metaruby.com/u/marin-cabac)\
**Replies:** 9\
**Last updated:** [October 31, 2017, 5:22pm UTC](https://metaruby.com/t/delete-every-other-item-in-the-array-until-only-one-is-left/1321 "2017-10-31T17:22:38Z")

</div>

Hello everybody, My problem is asking to iterate over an array of items and delete every other item until I reach the end of the array when I should start iterating backwards and keep deleting every other item and so on…

---

## [Ruby installation issue in centos](https://metaruby.com/t/ruby-installation-issue-in-centos/1282)

<div class="topic-metadata">

**Author:** [@asliyanage](https://metaruby.com/u/asliyanage)\
**Replies:** 2\
**Last updated:** [October 4, 2017, 7:46pm UTC](https://metaruby.com/t/ruby-installation-issue-in-centos/1282 "2017-10-04T19:46:37Z")

</div>

I have installed ruby in centos 7. Then i try to ran the tmuxinator it gives me below error. How to solve this issue? /opt/rh/rh-ruby23/root/usr/bin/ruby: error while loading shared libraries: libruby.so.2.3: cannot ope…

---

## [Remove some prefixes from the scope content](https://metaruby.com/t/remove-some-prefixes-from-the-scope-content/1204)

<div class="topic-metadata">

**Author:** [@pcfee](https://metaruby.com/u/pcfee)\
**Replies:** 1\
**Last updated:** [August 23, 2017, 10:55pm UTC](https://metaruby.com/t/remove-some-prefixes-from-the-scope-content/1204 "2017-08-23T22:55:14Z")

</div>

Hey together, i have this string: " \<xhtml super code=“www.super.de”:pre-wrap;\>{scope content}" Now i want to remove everything before the { How can I do this? I tried using split but i did not work. Please help me. …

---

## [Need help understanding recursian](https://metaruby.com/t/need-help-understanding-recursian/1188)

<div class="topic-metadata">

**Author:** [@marin-cabac](https://metaruby.com/u/marin-cabac)\
**Replies:** 1\
**Last updated:** [August 17, 2017, 11:28am UTC](https://metaruby.com/t/need-help-understanding-recursian/1188 "2017-08-17T11:28:46Z")

</div>

Hello, I have trouble understanding the following code for 2 reasons: I don’t exactly understand the task nor do I understand the way the algorithm operates. I would really appreciate if somebody could break it down f…

---

## [I have trouble understanding the use of \<end\> statement](https://metaruby.com/t/i-have-trouble-understanding-the-use-of-end-statement/1089)

<div class="topic-metadata">

**Author:** [@marin-cabac](https://metaruby.com/u/marin-cabac)\
**Replies:** 2\
**Last updated:** [July 3, 2017, 10:39pm UTC](https://metaruby.com/t/i-have-trouble-understanding-the-use-of-end-statement/1089 "2017-07-03T22:39:39Z")

</div>

hello everyone, Please consider the following code. I got it to work but by trial and error. I don’t really understand why the commands are where they are. I only understand the last - that shows the where the code en…

---

## [How To Copy The views and Controllers From the Rails Engine?](https://metaruby.com/t/how-to-copy-the-views-and-controllers-from-the-rails-engine/1111)

<div class="topic-metadata">

**Author:** [@bala](https://metaruby.com/u/bala)\
**Replies:** 0\
**Last updated:** [June 30, 2017, 12:38pm UTC](https://metaruby.com/t/how-to-copy-the-views-and-controllers-from-the-rails-engine/1111 "2017-06-30T12:38:22Z")

</div>

I am trying to create a new Rails Engine app and i succeeded using scaffold,But i had a doubt if anything i want to customize in the controller of particular gem What to do ? Only solution was we can copy the migration f…

---

## [How do I run multiple Ramaze apps on the same server?](https://metaruby.com/t/how-do-i-run-multiple-ramaze-apps-on-the-same-server/989)

<div class="topic-metadata">

**Author:** [@desbest](https://metaruby.com/u/desbest)\
**Replies:** 5\
**Last updated:** [June 28, 2017, 10:28pm UTC](https://metaruby.com/t/how-do-i-run-multiple-ramaze-apps-on-the-same-server/989 "2017-06-28T22:28:55Z")

</div>

I use the Ramaze framework http://ramaze.net I also use my Windows laptop for programming. I would like a directory structure like this —\> localhost:7000/ramazeapp1 —\> localhost:7000/ramazeapp2 Basically I am lookin…

---

## [Need help understanding command \<next\> in the code](https://metaruby.com/t/need-help-understanding-command-next-in-the-code/1094)

<div class="topic-metadata">

**Author:** [@marin-cabac](https://metaruby.com/u/marin-cabac)\
**Replies:** 8\
**Last updated:** [June 23, 2017, 1:24pm UTC](https://metaruby.com/t/need-help-understanding-command-next-in-the-code/1094 "2017-06-23T13:24:14Z")

</div>

Hello everybody, Please shed some light on the following code. I don’t understand at what point does the command get activated and also why is being incremented in two different places: once in the first while-loop a…

---

## [Dates and timezones - inconsistency with detected timezone](https://metaruby.com/t/dates-and-timezones-inconsistency-with-detected-timezone/1092)

<div class="topic-metadata">

**Author:** [@ncrause](https://metaruby.com/u/ncrause)\
**Replies:** 2\
**Last updated:** [June 20, 2017, 4:26pm UTC](https://metaruby.com/t/dates-and-timezones-inconsistency-with-detected-timezone/1092 "2017-06-20T16:26:13Z")

</div>

I’m working on a system which needs to be timezone aware, however I’ve come across an odd discrepancy. Consider the following: x = DateTime.parse("2017-02-01 12:00:00+0200") puts x.t\_time.inspect The result given is (c…

---

## [Stuck with code please help](https://metaruby.com/t/stuck-with-code-please-help/1079)

<div class="topic-metadata">

**Author:** [@marin-cabac](https://metaruby.com/u/marin-cabac)\
**Replies:** 4\
**Last updated:** [June 19, 2017, 7:46pm UTC](https://metaruby.com/t/stuck-with-code-please-help/1079 "2017-06-19T19:46:17Z")

</div>

Hello META RUBY, Can somebody please explain the following lines: if counts\[counts\_idx\]\[0\] == letter counts\[counts\_idx\]\[1\] += 1 I actually don’t understand the notation: counts\[counts\_idx\]\[0\] I understand this pa…

---

## [If array slot has no character value (a-z) then break](https://metaruby.com/t/if-array-slot-has-no-character-value-a-z-then-break/1061)

<div class="topic-metadata">

**Author:** [@mattClems](https://metaruby.com/u/mattClems)\
**Replies:** 5\
**Last updated:** [June 6, 2017, 11:54pm UTC](https://metaruby.com/t/if-array-slot-has-no-character-value-a-z-then-break/1061 "2017-06-06T23:54:33Z")

</div>

Hello, I am writing a simple program that takes a one line input of characters and ‘\<’ and then outputs what the input would look like if the ‘\<’ represented a desired backspace. For example if the input was “hello\<\<” th…

[Next page](https://metaruby.com/c/ruby-questions/23.md?page=1)
