Questions tagged [ruby-1.8.7]

For issues relating to developing in Ruby, version 1.8.7.

Use this specific tag along with the generic one: .

203 questions
0
votes
1 answer

syntax error - unexpected tASSOC

I am trying to learn some ruby http request response code from this tutorial - http://danknox.github.io/2013/01/27/using-rubys-native-nethttp-library/ Code so far - require "net/http" require "uri" uri = URI.parse("http://api.random.com") http =…
stack1
  • 1,004
  • 2
  • 13
  • 28
0
votes
1 answer

Regex causing high CPU load, causing Rails to not respond

I have a Ruby 1.8.7 script to parse iOS localization files: singleline_comment = /\/\/(.*)$/ multiline_comment = /\/\*(.*?)\*\//m string_line = /\s*"(.*?)"\s*=\s*"(.*?)"\s*\;\s*/xm out =…
Arnold Roa
  • 7,335
  • 5
  • 50
  • 69
0
votes
0 answers

ruby 1.8.7 readline $stdout conflict

Fellow Ruby developers. I am building a prompt interface with Ruby 1.8.7. As such, I'm using 'readline' in my codes. As it is a prompt interface I'm building, I want to create an option such that, should a user specify a logfile, all STDOUT and…
0
votes
1 answer

find and replace percent symbol within string with back slash in ruby?

I tried this : irb(main):125:0> a = "ab%c" => "ab%c" irb(main):126:0> a.gsub("%", '\\') => "ab\\c" irb(main):127:0> whereas expected output is: ab\c it did not work. Thanks in advance. Update: ruby version ruby -v ruby 1.8.7 (2011-06-30 patchlevel…
Vikash Singh
  • 13,213
  • 8
  • 40
  • 70
0
votes
0 answers

Ruby 1.8.7 + Rails 3.0.20 can't create engine - Commands is not a module (TypeError)

I want to create an engine for rails app with ruby 1.8.7 and rails 3.0.20 but when I type: rails plugin new try --full I get: /Users/tborisova/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.0.20/lib/rails/commands/plugin.rb:277: Commands is not a module…
Tsvetelina Borisova
  • 417
  • 1
  • 4
  • 14
0
votes
1 answer

Testing Sinatra app for get with request.body

Suppose I have an endpoint like so: get "/foo" do request.body.rewind data = request.body.read # some logic goes here end How do I test this in Sinatra? If I try: it "gets /foo" do payload = {:bar => "baz"} get "/foo",…
user650654
  • 5,630
  • 3
  • 41
  • 44
0
votes
1 answer

ActionView::TemplateError... Testing this school management system Fedena, but anytime i click on the quick link i get this error

ActionView::TemplateError (You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.include?) on line #2 of app/views/layouts/_quick_links.html.erb: 1: <%#*
Munn5
  • 1
0
votes
1 answer

Idiomatic Test::Unit equivalent of expect {}.to change {}.by(x)

Right now, I am simply using assert_equal twice - before and after the execution, and it does not hurt much. But I have used RSpec before and liked the readability of the expect{}.to change idiom. I cannot simply use RSpec in this project - not my…
kostja
  • 60,521
  • 48
  • 179
  • 224
0
votes
1 answer

RVM Install 1.8.7 in OSX

I received a new Macbook Pro for work and started to setup my local machine for development. I installed RVM, then proceeded to install different ruby versions: 2.1, 2.0, 1.9, and 1.8.7. I need 1.8.7 because I will be working on an older site…
RNickMcCandless
  • 717
  • 2
  • 9
  • 24
0
votes
0 answers

Error while installing fog in ruby 1.8.7

I'm working with fog under ruby 1.9 but in our new requirements we need to support ruby 1.8.x. I research and found this (https://github.com/fog/fog#ruby-187) that suggest adding: gem 'nokogiri', '~>1.5.0' will solve my problem but I'm still…
MemoGarcia
  • 71
  • 1
  • 5
0
votes
1 answer

Passing Non-ID Variable Through Rails Routes

Rails 2.3, Ruby 1.8.7 I'm trying to pass a variable through a rails route. I haven't been able to find a case where anyone was doing this with something that wasn't an id of a model. I'm not certain if that's the source of the problem. In the…
warder57
  • 350
  • 5
  • 16
0
votes
2 answers

Toggle little / big endian in unpack() in Ruby 1.8.7

In Ruby 1.9.3, you can do "\x00\x01".unpack 'S' #=> 1 * 256 + 0 = 256, my machine use little endian by default "\x00\x01".unpack 'S>' #=> 0 * 256 + 1 = 1 But Ruby 1.8.7 doesn't have the ">" "<" annotation. So in 1.8.7, what is the best way…
0
votes
1 answer

Child model not saved during seed

I am creating contacts & users in the DB in seed.rb. Using the code below, the contact is saved but the child user is not. What am I missing? I've tried with and without the if statement, and the user is never saved. Models class Contact <…
Josh M.
  • 26,437
  • 24
  • 119
  • 200
0
votes
2 answers

Rails bundle install tries to upgrade rake?

While running bundle install against a "fresh" deployment (e.g. no Gemfile.lock yet) with Ruby 1.8.7 and Rails 3.2.13, bundler appears to be attempting to upgrade to Rails 4! I'm not sure why it is doing this as I have the rails version specifically…
Josh M.
  • 26,437
  • 24
  • 119
  • 200
0
votes
2 answers

Compare multidimensional array and return index

Ruby 1.8.7 array = [[1.5,"cm"],[1.5,"cm"],[1.5,"m"]] How to compare each array inside the variable array and see if it is equal, if equal then move on else if not equal then return the index of the array element which was not equal and stop…
user2071444