Category "ruby"

Disabling irb autocomplete on Heroku

A follow up to Disable irb autocomplete I would like to disable IRB on Heroku, e.g. having an .irbrc with: IRB.conf[:USE_AUTOCOMPLETE] = false In the home dire

ROR + Unable to install tiny_tds

Here I am trying to fetch data from MS-SQL Server 2008 to my Rails application on Ubuntu 10. But I am unable to install tiny_tds. I follow the step given at git

Cannot install Ruby gem libxslt-ruby on Mac cause it does not find libxml2

I've installed libxml2 and libxslt through Brew on my Mac but gem install libxslt-ruby -- --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-lib=/usr/local/op

How do I loop through XML using Nokogiri to add certain parts to an array?

I have this as my XML: <systems> <system number="2" > <lists> <list critical="user" access="remote"></list> <

How to set env variables using ASDF in a Rails project

Rbenv uses rbenv-vars to specify per-application environment variables in Rails. Most version managers read the .env file in every project for the environment

Pluralizations and Singularizations (Inflections) for "Media/Medium" in Rails 5

I'm working with Rails 5 an I just have created a Media model using scaffold tool. rails g scaffold media name:string And I got different names and routes and

Disable irb autocomplete

The latest version of irb introduced an autocomplete that is quite buggy and I don't generally like to be distracted by an autocomplete, any idea how I can disa

Is it possible to use Factory Girl to update an already instanced factory?

I am trying to streamline our cukes trying to leverage the wonderful factories built into our system for unit tests. I am setting up a @bread ||= FactoryGirl.cr

Library not loaded: /opt/local/lib/libssl.1.0.0.dylib (LoadError)

I just discovered I can no longer gem push … any more and some digging led me to a need to update my RVM SSL certs. I ran rvm osx-ssl-certs status all b

How can I send mail with rails without a template?

In my Rails 3 project, I want to send some simple notification emails. I don't need to make a template for them or do any logic. I just want to fire them off fr

Is there any Ruby project for backup?

I have some rails projects and mysql database in the server, i need to backup them every 1-2 days. I would like to do backup with Ruby, who can give me some adv

Does Ruby have a string.startswith("abc") built in method?

Does Ruby have a some_string.starts_with("abc") method that's built in?

fix `Missing frozen string literal comment` issue

I created a new migration, it looks like this one: class AddCommentsToUsers < ActiveRecord::Migration def change add_column :users, :comments, :text

How to retrieve the field name of a ShapeFile feature field?

I am using gdal-ruby to parse ESRI ShapeFiles like in this demo. I want to iterate through all features in order to push the field values into a database. Howev

How can I format a float to a certain number of decimal and integer digits?

I am trying to format a float in Ruby to exactly four digits, including the decimal. For instance: 1 => 01.00 2.4 => 02.40 1.4455 => 01.45 Right no

display list of days in a week in Rails using Date::DAYNAMES

I'm having trouble displaying a list of days in a week in a form. <%= form_for [@hourable, @hour] do |f| %> <% days = [] Date::DAYNAMES.each_with

Problem with quantifiers and look-behind

### Ruby 1.8.7 ### require 'rubygems' require 'oniguruma' # for look-behind Oniguruma::ORegexp.new('h(?=\w*)') # => /h(?=\w*)/ Oniguruma::ORegexp.new('(?&

YAML indentation for array in hash

I think indentation is important in YAML. I tested the following in irb: > puts({1=>[1,2,3]}.to_yaml) --- 1: - 1 - 2 - 3 => nil I expected some

Converting zipfile extracting code from ruby to python

I am converting a code from ruby to python that extracts the contents of a zipfile. I am new to python and not sure how to exactly convert the below code. ruby