Questions tagged [ruby]

Ruby is a multi-platform open-source, dynamic object-oriented interpreted language. The [ruby] tag is for questions related to the Ruby language, including its syntax and its libraries. Ruby on Rails questions should be tagged with [ruby-on-rails].

ruby
48,535 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0 votes
2 answers
238 views

Why can't I change my Ruby version using RVM?

I am currently trying to switch my default version of Ruby from 1.9.3 to 1.9.2-p280. I ran these in my console: sudo apt-get install ruby-rvm rvm install 1.9.2-p290 rvm --default use 1.9.2-p290 ...
user avatar
0 votes
0 answers
365 views

Why is Net::HTTP.get_response throwing an error Errno::ECONNREFUSED: Connection refused - connect(2)?

I am trying to make a HTTP request using Capybara. When I attempt to execute the code below: Net::HTTP.get_response(uri) I get an error: Errno::ECONNREFUSED: Connection refused - connect(2) When ...
user_1357's user avatar
  • 7,868
0 votes
1 answer
288 views

Rails: decode text_field value

I have a rails app where I encode all my model data using an observer. I encode it using html codes. For example Börje's idé becomes Börje's idé. My problem now is whenever ...
Christoffer Reijer's user avatar
0 votes
1 answer
814 views

Unable to add users to Facebook Custom Audience through Koala gem

I am unable to add users to a custom audience. I am getting a return value of true (success), however after waiting, no users are ever added to the list. I have used the same list through the power ...
Garrett Davis's user avatar
0 votes
1 answer
625 views

Designing my own private messaging system in Rails 3.1 and Mongoid

I am trying to design a rails application with Mongoid that has a private messaging system Is there any tutorials that would help me get started? How should i begin on creating a rails messaging ...
user1470554's user avatar
0 votes
0 answers
80 views

Rails 3 - Set table_name_prefix based on subdomain

I currently have a model named Post which is currently using the default table name of posts. I am looking to change this so that it will use the subdomain as a prefix to the default, so essentially ...
Scott's user avatar
  • 1,127
0 votes
0 answers
108 views

Tell ruby controller to send error message back to same web page

I have a html form on my website that a user fills out. When the user clicks on the submit button I have a controller file that takes all the values from the form and uses them to insert into database....
thedarkknight228's user avatar
0 votes
1 answer
70 views

Bundler Starting with full path - issue

I am trying to run bundle from inside a folder of my RoR app and it works as expected. However, when I try to run it using the full path (need this for the cron jobs), it just fails with the error "...
Darko's user avatar
  • 527
0 votes
0 answers
236 views

Jquery show method doesn't work in my rails project

I have the following code in create.js.erb (called via ajax whenever an item is added to the cart) $('#cart').show('blind', 1000); $('#cart').html("<%= j render @cart %>") $('#current_item')....
Senjai's user avatar
  • 1,821
0 votes
0 answers
130 views

Ruby on Rails: NameError with acts-as-taggable-on gem

I am a relatively new web programmer and I'm trying to add this code on top of the /omrails tutorial. I'm able to get the gem acts-as-taggable-on to work until I input this code in pins/index.html.erb:...
harrisongill's user avatar
0 votes
0 answers
558 views

Is it possible to execute/run cucumber test scripts from a network drive?

I'm needing to store cucumber test scripts in a shared network drive in order for teams in other timezones to be able to run these scripts from a shared network drive rather than their local directory....
user2465163's user avatar
0 votes
1 answer
573 views

NoMethodError in MicropostsController#create

I've run into an issue with my Ruby on Rails app. I've a page called /discussion which contains discussions that users can comment on with microposts. The goal here is to have a form below each ...
nictoriousface's user avatar
0 votes
1 answer
174 views

Item color picker/swapper

Let's say I have two products: iPhone 5 64GB (White) and iPhone 5 64GB (Black). What's the best way to create a color picker/swapper if the names of the items include the color (which unfortunately ...
Dre's user avatar
  • 141
0 votes
1 answer
446 views

Why do I get "can't convert String into Integer" when accessing a JSON object?

I have a JSONString in key-value pair format, and, in my test, I am trying to verify the value for a particular key in the string using: JSONString['key'] should eq 'value' My value is a string like ...
tech_human's user avatar
  • 6,792
0 votes
1 answer
96 views

Array with array of hashes breaks code in ruby

I am new ruby and working on terminal game. I have an array of my deck_of_cards deck_of_cards =[ {:card=>"2C",:value=>2}, {:card=>"3C",:value=>3}, {:card=>"4C",:value=>4}, {:card=&...
sierra2's user avatar
0 votes
0 answers
64 views

How to catch parallel session? (Ruby on Rails app)

I have read that parallel session is when at the same time a user can be logged in into the web application multiple times. I have Ruby on Rails application and I don't know how to catch the parallel ...
Tsvetelina Borisova's user avatar
0 votes
1 answer
1k views

In ruby on rails how to get data from client side(android)

Android as a client side,i am sending data from client side to server side.Ruby on rails as server side,how to fetch data from client side using the post method. I want to get the data from client ...
Karthick M's user avatar
0 votes
1 answer
35 views

Google_spreadsheet how can i change the Row color

I'm rubynewbie. My application using google_spreadsheet gem. I want to change my google spreadsheet row color. Can anybody show me the sample code ?
user1989289's user avatar
0 votes
2 answers
497 views

accessing mongodb document field names and its values through iteration

Let's say I have a mongodb document in the products collection: { "_id" : ObjectId("51b1eac0311b6dd93a000001"), "name" : "Apple", "price" : "34.45" } products_controller.rb for def show ...
Askar's user avatar
  • 5,824
0 votes
1 answer
92 views

Access a variable from within a method when being passed a block that contains the variable

From what I understand every time it runs though run_times it pops off one of the run_times values and adds it to fake_time. And with my measure method I'm supposed to gather those and get the average....
Jet Rodriguez's user avatar
0 votes
1 answer
500 views

Bootstrap-Datepicker not working in Ruby App

When trying to use bootstrap-datepicker-rails in my Ruby app, I get the error: Uncaught TypeError: Object [object Object] has no method 'datepicker' The JS/Coffeescript code i'm using is: jQuery -&...
user2421006's user avatar
0 votes
1 answer
136 views

rails sending code block to partial

Rails 3.2.13 & ERB I am trying to get send some link_to items to a partial. I am sending in a title to the partial successfully as below. <%= render :partial =>'form', :locals =&...
carlsonjf's user avatar
0 votes
1 answer
86 views

My login over localhost wont work with my heroku site

I am having the same problem as another guy who posted this question about two months ago, but I wasn't able to figure out the solution based on the answers that people gave him. I am a total newb to ...
user2461180's user avatar
0 votes
1 answer
139 views

How to handle exceptions in DCI

Imagine that you have a context that handles money transfers between user's accounts. class Account < ActiveRecord::Base belongs_to :user end class MoneySender < SimpleDelegator class ...
GuidoMB's user avatar
  • 2,201
0 votes
2 answers
61 views

Ruby on rails passing information from session into db

I have been trying to set up a little twitter app to teach myself ruby on rails, i have a log in page that works and stores the user like this session[:user_id] = user.id I can use that in the ...
Tormyst's user avatar
  • 187
0 votes
1 answer
72 views

Using Facebook Graph API, how can I print a user's full name in a standalone ruby code?

I am trying to learn Facebook Graph API but don't know how to start. For example, how can I get the object representing user with ID 1234567 and print the full name in standard output? I want to do it ...
Louis Rhys's user avatar
  • 35.1k
0 votes
1 answer
124 views

ruby on rails -v gives error

i am getting this error below /usr/lib64/ruby/site_ruby/1.8/rubygems.rb:926:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError) from /usr/lib64/ruby/site_ruby/1.8/...
kangoroo's user avatar
  • 359
0 votes
1 answer
100 views

Active record query linked with select box

I'm using an active record query to group values by type and average them. Each grouped type has a distinct average. I'm currently able to display all of the distinct averages. I plan to use ...
bork121's user avatar
  • 113
0 votes
1 answer
80 views

How do I create shallow routes inside a nested resource?

How can I setup my routes file to create the following routes: /forums/1/posts # GET index /forums/1/posts # POST create /forums/1/posts/new # ... the other forum posts restful ...
dee's user avatar
  • 1,858
0 votes
1 answer
72 views

ruby on rails foreign keys

basically what I am trying to do is use a foreign key. E.g. 144 which will return an object. I keep getting an error saying the record number cannot be found. In the order show view. (I have tested ...
baihu's user avatar
  • 461
0 votes
1 answer
271 views

Where is the file that generates the config.rb file?

When I create a new Compass project, it generates several directories and files and provides the config.rb file. Rather than changing the config file every time I start a project, can I set this up in ...
Thomas Grauer's user avatar
0 votes
1 answer
767 views

How to fetch albums photos from facebook using fb_graph gem?

I created a photo album on facebook named 'exemple'. Is it possible to fetch all the pictures links of The album knowing only the name of the album? How do I proceed with fb-graph gem?
Jonnyx Delavilla's user avatar
0 votes
1 answer
175 views

ruby timeout not working with external url

The code below should raise Timeout::Error after 1 second. It does NOT raise after 1 second though. It raises after the url actually times out. I'm trying to figure out why. Timeout::timeout(1) { Net:...
djburdick's user avatar
  • 11.8k
0 votes
0 answers
801 views

Mongoid: filtering an embedded collection by sub-sub-documents multiple fields

I am a beginner in mogo and mongoid. I it possible to filter sub-documents collection by a sub-sub-documents multiple fields ($elemMatch)? I'm trying to make a parametrized scope for an embedded ...
SilentShade's user avatar
0 votes
3 answers
2k views

Rake db:migrate error Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter`

Briefing: I've been attempting to deploy my blog to heroku for the last week with no luck. I've contacted Heroku support and they've pretty much told me to post the log on stackoverflow. So here I am. ...
user avatar
0 votes
1 answer
686 views

Selenium AndroidDriver - Unable to switch to iframe "Cannot read property 'document' of undefined"

I'm unable to switch over to the iframe inside of AndroidDriver. The details are below. I've tried with the regular webdriver using firefox and i'm able to switch over just fine. Code: require "...
davidtran's user avatar
0 votes
0 answers
450 views

Selenium - Detect if external javascript file was loaded by browser - ruby

I'm currently trying to integrate Selenium into my rails app for testing purposes, and surprisingly I'm having trouble with something I thought would be straight-forward: detecting if the browser is ...
user1138940's user avatar
0 votes
0 answers
151 views

pageup or page down keystrokes not recorded when recording automation test scripts

In trying to test a website for inserting text but the element needing the text inserted is out of view, which has causes the script to fail. I need to scroll the scroll bar, press the page down key ...
dcwilson042's user avatar
0 votes
0 answers
317 views

Search keyword from HTTP response in #<Nokogiri::XML::Comment data

I am using ruby to send a http request, and receive response. Now I need to search for a keyword in the response. I use Nokogiri::HTML(response.body) and following is the part of the http response ...
Sunshine's user avatar
  • 489
0 votes
1 answer
769 views

How to save tweets from TweetStream with SQLite3 and Ruby

I am very new to ruby and RoR. I would like to save incoming tweets that are currently being displayed on my terminal. Could you explain why the tweets are not being saved? I run " ruby mine_tweets....
FloofyDoug's user avatar
0 votes
2 answers
88 views

Neat ruby way of returning failure or continuing after function call

I often have code of the following nature ret = function_call( arguments ) return -1 if ret == -1 ret = another_function_call( arguments2 ) return -1 if ret == -1 ... pattern repeated several ...
av501's user avatar
  • 6,673
0 votes
0 answers
1k views

Redmine - ruby process eating 100% memory

I have installed Redmine on cent-os. I have configured it on Apache with Passenger .And It s been used by hardly 400 people. At the particular point of time ,Ruby Process eats to much of memory. ...
Arpit Vaishnav's user avatar
0 votes
1 answer
227 views

MongoMapper two one-to-many relationships on one model

I am trying to model a question/answer system similar to StackOverflow's in that there is a Question, it has Answers and the Question and Answer both belong to different users (but the Answer also ...
Zen's user avatar
  • 7,245
0 votes
0 answers
287 views

Add customer's address to stripe through rails app - monospace

I'm about two months in to learning RoR. Trying to setup a subscription site using https://monospace-rails.herokuapp.com/ and want to add customer's physical address fields to the form. For some ...
goscratchit's user avatar
0 votes
1 answer
115 views

How to handle two nested siblings, with to_json next?

The to_json ActiveRecord docs say this for dealing with two nested models, where comments is nested in posts: konata.to_json(:include => { :posts => { :...
JZ.'s user avatar
  • 21.5k
0 votes
1 answer
2k views

Mac OS X Lion - mysql: command not found

I have installed MySQL from this source, installation was successfully finished. But when I run in terminal which mysql, the output is empty. When mysql, the output is -bash: mysql: command not ...
user984621's user avatar
  • 47.4k
0 votes
0 answers
555 views

undefined method `split' for nil:NilClass in application_helper.rb method

I am struggling to get this application_helper method to work. I am copying a few helper methods and pages from other open source code which is why it isn't working yet - I am converting some sinatra ...
Sean L's user avatar
  • 827
0 votes
0 answers
741 views

How to recover a crashed EventMachine loop

I'm using Unicorn on Heroku and I created an EventMachine loop: (from https://gist.github.com/jonkgrimes/5103321) after_fork do |server,worker| defined?(ActiveRecord::Base) and ActiveRecord::...
Chris Doyle's user avatar
  • 1,039
0 votes
1 answer
124 views

Tire filtering not working?

So, I have a class called Fundraiser: class Fundraiser def search! search = Tire::Search::Search.new('fundraisers') search.query { all } search.filter :range, {id: {gt: 1}} ...
Matt Darby's user avatar
  • 6,294
0 votes
1 answer
707 views

Why is Rake aborting because of "Bad file Descriptor"?

I have a problem creating a database using rake db:create. I followed the "Fat Free CRM Guides: Installation on Microsoft Windows" guide to install the Fat Free CRM on Windows. I am on 32-bit ...
Alexander T's user avatar

1
847 848
849
850 851
971