How to sync local code changes to github?

Ruby
I have made my very first repository on GitHub: https://github.com/Konstantinusz/picstate I simply followed this help page: https://help.github.com/a...
2 years ago

Telling the rspec which input to use in a interactive ruby script?

Ruby
I defined different test-cases: Running the script with a URL as a parameter, which should be passing. Running the script without a parameter, which...
2 years ago

(Beginner) Rock, Paper, Scissors game in ruby

Ruby
I am trying to get this ruby program to run properly, but there are a few issues I am having. First, the program will run, however it doesn't matter...
2 years ago

accepts_nested_attributes causing Stack level too deep

Ruby
I have a very basic example app/models/user.rb #name string class User < ActiveRecord::Base has_one :project,dependent: :destroy validates :...
2 years ago

Adding a validation error in a controller in Rails 4

Ruby
In a controller I have a code which isn't associated with the model directly: def create var1 = get_some_post_param # check if var1 isn't nil --...
2 years ago

Multiline strings with no indent

Ruby
How do you have a multiline string with no leading spaces and still be properly aligned with method? Here are some of my attempts. The one that is w...
2 years ago

ruby 1 to 100 odd numbers in array

Ruby
Is there any cool way in Ruby to create an array with 1 to 100 with only odd entries (1, 3 etc). I now have a loop for this but that is obviously not ...
2 years ago

Remove YAML header from markdown file

Ruby
How to remove a YAML header like this one from a text file in Ruby: --- date: 2013-02-02 11:22:33 title: "Some Title" Foo: Bar ... --- (The YAML i...
2 years ago

Ruby: conditional matrix? case with multiple conditions?

Ruby
In ruby, I was wondering if there's a way to do the following: I have basically a matrix of four possible outcomes: A is True, B is True A is True, ...
2 years ago

How to add a method to an existing object instance at runtime in Ruby?

Ruby
In Javascript I could do this. var a = {}; a.f1 = function(){}; How can I do this in Ruby? Update. In JS code, a is an object instantiated with...
2 years ago

Call method only if it exists

Ruby
Is there some hidden Ruby/Rails-magic for simply calling a method only if it exists? Lets say I want to call resource.phone_number but I don't kno...
2 years ago

Ruby C extension: turning int function into ruby value

Ruby
I'm trying to wrap the following function to make a C extension. int dsvd(float **a, int m, int n, float *w, float **v){ //do some things } And...
2 years ago

How to check many files exist with ruby code in windows

Ruby
I want to check all file having .war extension and move them to another folder in chef-client windows but it does not work. if !Dir.glob("C:\\tempwar...
2 years ago

Method in admin tool deleting all contents of file

Ruby
I created a user tool that will allow admins of a forum to add, edit, and delete users from their desktop, then give them the ability to upload a file...
2 years ago

Ruby Ternary Operator Syntax Issue

Ruby
I am learning Ruby and I'm not sure what's wrong with my code. I've tried putting each argument within parenthesis, as well as using "true" and "false...
2 years ago

Ruby Style Question: storing hash constant with different possible values

Ruby
This is more of a style question, I'm wondering what other people do. Let's say I have a field in my database called "status" for a blog post. And ...
2 years ago

JSON file parse error from delete_user method

Ruby
I have a program that saves to a JSON file, this is my first attempt with a JSON file so I apologize if this is a very simple question. I have a meth...
2 years ago

Ruby: SSL_connect SYSCALL returned=5 errno=0 state=unknown state (OpenSSL::SSL::SSLError)

Ruby
Variants of this error have been posted all over the place but none of the solutions seem to work for me. I'm running ruby 2.2.2p95 (2015-04-13 revis...
2 years ago

accessing variables in loaded source while in irb

Ruby
Say I have a file named test1.rb with the following code: my_array = [1, 2, 3, 4 5] Then I run irb and get an irb prompt and run "require 'test1'. ...
2 years ago

web.1 | bundler: command not found: puma

Ruby
I have a simple rails 4 app on my local machine and the Gemfile looks like this source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rai...
2 years ago