Tagged Questions
Ruby is a multi-platform open-source dynamic object-oriented interpreted language created by Yukihiro Matsumoto (Matz) in 1993.
0
votes
0answers
2 views
Basic Shoes: Input through an edit line
How does one make an edit line in shoes that takes the user's input and stores it in a variable after they hit enter (similar to the console) rather than making them click a button.
I tried to use ...
0
votes
0answers
14 views
What means '$ bin' in $ bin/rails?
guys. I'm trying to follow along the "Getting Started with Engines" Rails Guide's tutorial and found this:
$ bin/rails plugin new blorgh --mountable
When I type this on my terminal, I get:
bash: ...
0
votes
2answers
10 views
Ruby on Rails - Validations and Before Filter method to substitute User Inputted Values
In my Ruby on Rails app, I have a sign-up form, where users have to enter some data. I have strict validations that only allow entered values that are members of an array. This isn't part of my app, ...
2
votes
1answer
29 views
Extract and replace emails and phone number from string
I need to hide emails and phone number in a string. Replacing well formatted emails/number is easy with a regex, but what about other formats? Here is an example:
Input:
Email addresses ...
0
votes
0answers
4 views
Process page, or be notified that elements are present even if page not fully loaded
The page I'm using watir-webdriver on will often not load completely for maybe like minute because of the many external scripts I'm loading/using. This of course means that I have to wait needlessly ...
0
votes
0answers
7 views
Delete a huge amount of files in Rackspace using fog
I have millions of files in my Rackspace Files. I would like to delete a part of them, passing lists of file names instead of deleting one by one, which is very slow. Is there any way to do this with ...
1
vote
5answers
40 views
Bringing values into a loop in Ruby
This is almost certainly a duplicate, but I can't find the original - I don't know the search terms to use. Which is why I'm on Stackoverflow instead of Google :)
Anyhow, here's my code:
def ...
0
votes
0answers
6 views
How to override redmine.rb permissions in plugin init.rb
I am developing a redmine Plugin which has the task to offer some additional allow/disallow options, one of the features should be that the admin can allow/disallow the access to issue reports for ...
-1
votes
1answer
22 views
Parsing CSV file. Separating into more files
I am currently working on a small application that will allow someone to enter strings that'll separate a larger file into smaller files.
I am having trouble getting the file to be split into the ...
-7
votes
1answer
43 views
Intensive Code Course. Ruby on rails or Front End Engineering [on hold]
I'm actually deciding if I'm going to do a course of Front End Engineering or Ruby on Rails. I'm not very good a matching colors or stuff like that and I have low experience with Adobe programs like ...
0
votes
0answers
10 views
Can Devise request_keys be optional?
I am trying to authenticate by subdomain but cannot seem to get devise to behave the way I'd like. I've been through the devise wiki and didn't see the answer to my question.
In my devise.rb:
...
0
votes
2answers
19 views
Create a record in Rails from AngularJS
I have an Angular application that sends http requests to a rails server. I'd like to make a request to create a record (in the table SavedQueries).
The Angular app is actually making a very simple ...
1
vote
1answer
26 views
Rails test if a value fits with the type of a column
I need to check if a value fits with the type of a column, something like this
1.is_a? Product.columns_hash["id"].type
"a".is_a? Product.columns_hash["id"].type
But ...
0
votes
1answer
13 views
form_for details not displaying in view :Ruby on Rails
Hi I am using simple form_for to create new object but on the ads/new.html.erb on h1 tag is displayed but form's information is missing
Here is my new.html.erb file contents
<h1>New ...
0
votes
0answers
27 views
Syntax error when running 'bundle install' for Gemfile
I'm following Michael Hartl's tutorial on Chapter 9 (http://www.railstutorial.org/book/updating_and_deleting_users).
Whenever I edit my Gemfile and manually type in a gem that I'd like the install, ...
1
vote
0answers
31 views
Disabling paths in Rails
I'm trying to figure out how to disable the Rails magic of loading paths by default.
For example Rails has these paths.
Rails.config.autoload_paths
Rails.config.eager_load_paths
Rails.config.paths
...
0
votes
1answer
25 views
Rails file field being interpreted as String?
I am trying to provide a form field to be a file input on a rails site. My form is set up like the following
<%= form_tag({:action => 'submit_bulk_adjustment',:id => 'uploadForm', ...
2
votes
1answer
9 views
rspec 3 - stub a class method
I am upgrading from rspec 2.99 to rspec 3.0.3 and have converted instance methods to use allow_any_instance_of, but haven't figured out how to stub a class method. I have code like this:
module MyMod
...
1
vote
3answers
18 views
Trouble displaying associated records in Rails
I am working on a rails app that has two tables - customers and jobs. A customer can have many jobs and each job belongs to a customer. I have my associations set up and working accordingly.
I am ...
0
votes
1answer
35 views
Why am I getting `method_missing`?
I'm not sure but I think my something may not be right with my relations? I'm getting method_missing. Is it because I'm getting an Array back from active-record.?
event = Event.last
Event Load ...
0
votes
0answers
16 views
Homebrew install using Sudo GUI instead of command line
I'm working with this homebrew formula I found on Github
https://raw.githubusercontent.com/indrajitr/homebrew-personal/master/Formula/java-sdk.rb
This java formula requires sudo privileges. I was ...
0
votes
1answer
28 views
Retrieving people who +1 an URL
I've burning out the past 2 days trying to come with a recipe to get all the People who have +1 an URL, I'm trying to calculate the potential reach of a publication in Google+.
I did get the public ...
-8
votes
7answers
66 views
Printing 0 to 50 inclusive?
Why is this code not printing 0 to 50 inclusive?
i = 0
until i <= 50 do
print i
i += 1
end
0
votes
2answers
26 views
Rails querying databsae [duplicate]
I am trying to create an instance Object of all Users that have one or more Video in my controller, so there is one User that has many videos. So I have a User.rb model that has_many :videos, and my ...
0
votes
1answer
14 views
Log out of app with cURL
We have a web app built in Ruby on Rails that uses Devise for logging in and out. I'm responsible for a backend XML API using cURL. Users can log in, send updates, etc. at a command prompt with cURL ...
0
votes
1answer
13 views
Can't run the correct Ruby version with rbenv
After installing rbenv, I wanted to switch to the correct Ruby version to work on a project, but there seems to be an issue recognizing it.
$ cd project/
$ bundle install
$ Your Ruby version is ...
0
votes
2answers
16 views
Create Active Model datetime with Epoch Timestamps
I have a mobile application that can create events by sending a Post request to our Rails application using the standard routing for a SimpleEvent model. The important pieces of the model look like so ...
0
votes
1answer
50 views
Rails - How to pluralize a sentence? [duplicate]
I know you can pluralize a word in Rails using the pluralize feature.
pluralize (3, 'cat')
=> 3 cats
But what I'm trying to do is pluralize a sentence that needs to pluralize multiple words.
...
-3
votes
0answers
26 views
i need help in installing the pg gem?
Christopher-MacBook-Pro:`rails_projects jtorkornoo$ gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config`
Building native extensions with: `'--with-pg- ...
0
votes
0answers
16 views
Rails Carrierwave and Jbuilder
I'm using Carrierwave to upload images to my application and JBuilder to generate JSON, by default I get the following:
"image": [
{
"image": {
"image": {
...
0
votes
3answers
23 views
add position to new entry in Rails 4
I am new to Ruby on Rails and want to do the following:
I have a list of user stories which is ordered by position using jQuery sortable. This all working great. The problem is that when I create a ...
1
vote
1answer
22 views
Accept Friendship is not updating (Mutual Friendships)
I'm going through one of Treehouse's videos on Mutual Friendship. The problem that I'm having is when the user clicks on the 'Accept Friendship' button a flash message is displayed stating that they ...
-4
votes
0answers
22 views
How do I complete conditions for passing the driving test for Maita? [on hold]
I am stuck on ‘8.1 The Debugging Primaries’ at rubymonk.
How do I complete conditions for passing the driving test for Maita?
#<VisualAcuity:0x00000002d67c78 @subject=20.0, @normal=200.0>
So, ...
1
vote
1answer
37 views
Ruby on Rails multiple Buttons
I have the following written:
<% if @document != nil %>
<%= form_for(@document, :html => { :multipart => true }) do |f| %>
<% if @document.errors.any? %>
<div ...
0
votes
0answers
14 views
How to integrate with magento using the rest api and oauth
I am using the method here to integrate with magento. However it is telling me that the link at /api/rest/products does not exist on magento (Net::HTTPNotFound). To test this I logged into magento and ...
0
votes
2answers
21 views
Including empty subdirectories in Ruby recursive copy
Looking at the Fileutils.cp_r documentation, it seems to be using cp -r in a shell. This command will ignore subdirectories that are empty (at least on my OS X 10.9 machine).
Can anyone suggest a ...
0
votes
1answer
28 views
How can I convert my JSON response's key from snakecase to camel case?
I just started using Rails for my web application's framework. Now I'm working on an API for a test project. I want the key of my API's JSON response to be camelcase instead of snakecase. How can I do ...
0
votes
0answers
16 views
Benchmarks written in different languages OR cross-language benchmarks
I need benchmarks that are implemented in different languages (at least C, JavaScript, Ruby; maybe also R, Smalltalk...) so that I can compare the peak-performance of different languages.
Also, I'm ...
0
votes
0answers
9 views
Timeout when Frank Test Fails
Keeping in mind, I am completely new to Frank and ruby..
Whenever we run Frank and a test fails, Frank lets us know the test fails but the inbuilt Frank server just seems to sit there and timeout for ...
2
votes
1answer
19 views
Replace internal state of Matrix object
Similar to Array#pop(), I want to create a destructive method that removes the last column of a matrix: Matrix#hpop() (h stands for horizontal).
How can I make this method destructive? There is no ...
0
votes
1answer
21 views
Asset compression in Rails 4.1
I am having trouble forcing the assets to compress for my app.
I have included the following lines in production.rb:
config.assets.compress = true
config.assets.js_compressor = :uglifier
...
0
votes
0answers
28 views
Refactor it code model?
class Reservation < ActiveRecord::Base
validates :table, presence: true
validates :start, presence: true
validates :finish, presence: true
validate :checking_the_time, ...
0
votes
2answers
28 views
Advice on handling frontend User Inputs
I've been working with Ruby & RoR for a few weeks now and must say, this is a beautiful language, it's been very enjoyable to work with.
I'm hoping someone can point me in the right direction ...
0
votes
1answer
24 views
undefined method pluralize for main:Object
I'm trying to test a method in my console, but even the basic pluralize -
pluralize(1, 'person')
wont work..
Output:
NoMethodError: undefined method 'pluralize' for main:Object
from (pry):42:in ...
0
votes
2answers
19 views
How can I add “Like” functionality to my blog post without logging in
Assume I have a blog and some posts made in Rails.
Is there anyway to add "Like" functionality to my blog post so users could Like my posts without logging in? (There is no logging in for users!)
If ...
-1
votes
0answers
15 views
Factory not registered: sub_field (ArgumentError) sporadically
2 out of 3 times that I run rspec spec I get
/home/patrick/code/rails/trust_label_app/vendor/bundle/ruby/2.1.0/gems/factory_girl-4.4.0/lib/factory_girl/registry.rb:24:in `find': Factory not ...
1
vote
2answers
33 views
Mavericks, RBENV, Your Ruby version is 2.0.0, but your Gemfile specified 2.1.1
I've read and tried the suggestions in several, other, questions, like mine (all with accepted answers) as well as a few more hours of Google searching, but nothing worked. That leads me to think my ...
0
votes
3answers
25 views
Ruby on Rails object saves with blank values
group controller:
def show
@cat = Category.find_by_id(params[:id])
if @cat.group
@group = @cat.group
@members = @cat.group.group_members.all
@mem = ...
0
votes
1answer
13 views
Start postgres server downloaded from ruby gem on ubuntu
When I run rake:db migrate from my rails app, I get this output:
rake aborted!
PG::ConnectionBad: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) ...
5
votes
1answer
55 views
Cannot refine String with CONSTANT
I'm currently exploring refinements in Ruby 2.1.1 and I'm running into something odd. I'm trying to refine the String class and define a constant called FOO.
sandbox.rb
module Foobar
refine String ...