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

The Ruby way to group and count, refactor

I have a table that stores what users input into a search field. I wrote an action that displays the most popular searches and the number of times the search has been made. To do this I wrote the following sql query in the controller... SELECT…
Alaric
  • 229
  • 1
  • 12
0
votes
1 answer

How to deserialize multiple objects in ruby 1.8.7 lazily

I need to serialize lots of objects to a file (multiple GBs). We have chosen to use Google's protocol buffers for other things in this project, so I thought I would use that to serialize the objects I receive from the wire. This seems to…
0
votes
1 answer

Regex error in Ruby 1.8.7 but not 2.0?

In Ruby 1.8.7 the following regex warning: nested repeat operator + and * was replaced with '*'. ^(\w+\.\w+)\|(\w+\.\w+)\n+*$ It does work in Ruby 2.0 though? http://rubular.com/r/nRUSP5LNZA
kreek
  • 8,774
  • 8
  • 44
  • 69
0
votes
1 answer

Static format validators in ActiveRecord?

In an ActiveRecord model, are there any static/canned formats I can use? For instance, when validating the format of an email address I can either make a static regex to reuse on other models or perhaps use some static that already exists in the…
Josh M.
  • 26,437
  • 24
  • 119
  • 200
0
votes
2 answers

After using a formula in an .each, the number in the array won't change

What I have is: p(array) array.each { |c| c=c*y**z-1 ; z=z+1 } p(array) The array is: [35, 35, 35] y is 36, z is a counter, c is the value in the array. Before the formula I get: [35, 35, 35] [formula happens] After the formula: [35, 35, 35]
0
votes
3 answers

Ruby not Saving/Storing Values

My problem is that chips is not saving as a global variable for the argument it is passed. I am passing $h1c (which is the number of total chips player's first hand has). So if he wins or loses, chips should then be set equal to chips + or -…
CRABOLO
  • 8,605
  • 39
  • 41
  • 68
0
votes
4 answers

ruby 1.8.7 replace params hash

I use ruby 1.8.7 and get the params from my form like this: "cart"=>{"1140229"=>["5"], "1140228"=>["4"], "1140222"=>["7"]} And, I use rails 2.3 (it's too old, I know it!) which requires this syntax: 1140229 => { :quantity => 5 }, 1140228 => {…
Alex Antonov
  • 14,134
  • 7
  • 65
  • 142
0
votes
1 answer

rails 3 ruby 1.8.7 app slow startup on the web

ive been working with rails 3 and ruby 1.8.7 and ALWAYS (in all my apps), i have problems with the STARTUP time delay. it sometimes loads ok, and sometimes takes more than 12 seconds (or more) just to start loading the site. one of my…
yojuako
  • 3
  • 1
  • 3
0
votes
2 answers

How can I force sessions closed at a specific time?

I would like to build a rake task or a tool to destroy all active sessions that is called from CLI when I want and on every night at around 9:00 pm or so. I found that Devise has the ability to specify a timeout. I use Devise for user sessions.…
Crash
  • 321
  • 1
  • 4
  • 15
0
votes
1 answer

upgrading from rails 2.3.2 to 2.3.18 giving ActiveRecord::StatementInvalid on simple query

I'm moving an old application from rails 2.3.2 to 2.3.18, ruby 1.8.7-p72 to 1.8.7-p374. (and then after that, to ruby 1.9.3 and rails 3) My first query I tried which should be simple is giving me problems. In the console: ?> User.find(:all, :joins…
0
votes
2 answers

Ruby on Rails - get Linux Root?

I am simply trying to get the root path to look up a file on my machine, I am pretty new to RoR. Is there some sort of variable somewhere so I could do something like this: def path return '{#ROOT}/some/path/file.txt' end I do not want the…
naspinski
  • 34,020
  • 36
  • 111
  • 167
0
votes
2 answers

get value from text_field without submitting?

What I need- some kind of way to grab the number entered into the form in order to check it against previous records PRIOR to updating, so that if a validation error occurs, the user can be prompted to confirm before the form is submitted. Params…
Crash
  • 321
  • 1
  • 4
  • 15
0
votes
1 answer

Removing singleton dimension of scan capture group

I am trying to come up with a good way to do the following. I have a string, such as this one: foo = "bar = everybody\nbar = say\nbar = hey\nbar = ho" And I am scanning through it like this: foo.scan(/^bar = (.*)$/) That returns: [["everybody"],…
Dan Grahn
  • 9,044
  • 4
  • 37
  • 74
0
votes
2 answers

Sorting! Each blocks, attributes Ruby 1.8.7, Rails 2.3.15,

I have an app that manages images associated with buses. My problem is that I can't figure out how to sort an each block by a particular BusImage attribute, :thumb_order instead of the BusImage id. A Bus has many BusImages. The instance variables…
Alaric
  • 229
  • 1
  • 12
0
votes
1 answer

Box API: Is it possible to list the groups a user belongs to?

My question is simple, I'm trying to build a system to manage Users and Groups for each User, so in order to add a user to a group (or remove the user from a group) I need to know which groups this user belongs to in both sides. Otherwise I have to…
LuisVM
  • 2,763
  • 3
  • 20
  • 22