Ruby is an open-source dynamic object-oriented interpreted language created by Yukihiro Matsumoto (Matz) in 1993.
0
votes
0answers
3 views
Elasticsearch + Tire + PaperClip : Nested objects
I start implementing ElasticSearch in place of a old home-made search engine. I migrate the major part of the code, but I have to render a url provided by paperclip, and I cannot have the right object ...
1
vote
6answers
30 views
Built in ruby method for “reshaping” a hash?
Say I have this hash which I just retrieved from a database:
original_hash = {
:name => "Luka",
:school => {
:id => "123",
:name => "Ieperman"
},
:testScores => [0.8, ...
0
votes
0answers
9 views
Tumblr Login Script With Mechanize
I'm trying to make a ruby script using Mechanize, so I can login into Tumblr. I have the following script:
require 'rubygems'
require 'mechanize'
def get_page link
agent = Mechanize.new
page ...
0
votes
0answers
7 views
Octopus Database connections
We switched to using Octopus for sharding in our rails2.3/postgresql/resque app because we were maxing out the Disk I/O of our database server. We have 10 databases, each with multiple shards (A shard ...
-1
votes
0answers
22 views
bitcoin: Assign an individual key for every user and update mysql if the transaction was successfull
I'm currently setting up a webstore, but i have no idea what would be the best approach to archive the following problemset with Bitcoins:
I need to generate an individual key for every user and ...
0
votes
1answer
35 views
Parsing Ruby code for certain function calls
I want to write a gem that can be used to parse Ruby code and report on whether or not it detects the presence of certain function calls. My particular use case is that I want to ensure that no ...
-1
votes
1answer
17 views
What assertion functions are there in “minitest/spec”?
I'm using the new "minitest/spec" module to write specs for my classes, but it appears to be very poorly documented. Here's an example:
require 'minitest/spec'
require 'minitest/autorun'
module ...
0
votes
4answers
39 views
Convert string object to active record class
So I am interested if there is a way to convert string to active record class.
Example:
I have a User class which has inherited from ActiveRecord::Base.
Is there any way I can convert string "User" to ...
0
votes
3answers
24 views
Ruby IRB - dumping all classes
I am practicing with IRB (actually Wirble). I was wondering if any hacking inside IRB could be dumped into a file for later diff-ing, editing and reusing?
You create classes, methods, data on the ...
0
votes
5answers
32 views
Increment array till a variable's value using ruby array splat
I am using the ruby array splat like this:
array = *1,2,3
Output = [1, 2, 3]
count = 10 #Initializing count
Question: I want the array to be continued till the count = 10 when I try this it ...
0
votes
2answers
28 views
Can the order of my array be guaranteed to be preserved?
In an application i'm making in Ruby, I store objects in a MongoDB database using MongoMapper.
At a certain moment I'm saving a hash with the following structure:
{String => { String => ...
1
vote
0answers
17 views
Use whenever with sinatra
I'm trying to get whenever to work with sinatra. When I run the whenever command, I get the generated cron tab. But the problem is, that in my sinatra app, I don't have a script/runner file, which is ...
0
votes
0answers
23 views
'Segmentation fault' when executing Enumerator#next in rails console
I am getting error when executing the following code in rails console:
[1,2,3].to_enum.next
Trace:
(irb):1: [BUG] Segmentation fault
ruby 1.9.2p320 (2012-04-20 revision 35421) [i686-linux]
-- ...
1
vote
4answers
71 views
Rails - Routing Error 'No route matches [PUT]'
I'm trying to make a small app that allows users to create a sale. There is a user model product model and photo model. A user has many products and products has many photos. But for some reason after ...
-5
votes
0answers
48 views
how to delete a key-value pair in ruby hash? [closed]
myHash={1=>'a',2=>'b',3=>'c'}
I want to remove {1=>'a'} and let myHash={2=>'b',3=>'c'}, but myHash.delete(1) does not work?