Category "ruby"

Other Ruby Map Shorthand Notation

I am aware of the shorthand for map that looks like: [1, 2, 3, 4].map(&:to_s) > ["1", "2", "3", "4"] I was told this is shorthand for: [1, 2, 3, 4].m

Use if statement in layout.html.erb in a Sinatra app

Within my Sinatra application I would like to serve a minified version of my css/js for production but in development keep my default setup (individual files).

-bash: /Users/myname/.bash_profile: Permission denied

I installed rvm (ruby version manager) and it was success, but I got WARNING: You have '~/.profile' file, you might want to load it, to do that add the fo

What is the send() method used for?

Could someone please help me to understand what the 'send()' method listed below is used for? The code below, when I am reading it, makes no sense what purpose

Redis increment only if < certain number?

How do I call .incr on a key and have it increment ONLY if the resulting number is < than a certain number without having to call .get beforehand? The reaso

How can I resolve sorbet error: "Constants must have type annotations with T.let when specifying # typed: strict"?

This is similar to my question in How can I resolve sorbet error: "Use of undeclared variable"?, but for constants. I am experimenting with adding sorbet type i

An error occurred while installing unf_ext (0.0.7.2), and Bundler cannot continue

I was trying to install diaspora into localhost. I removed the Gemfile.lock file and tried bundle install and am seeing this. These are the things I already tr

How can I resolve sorbet error: "Constants must have type annotations with T.let when specifying # typed: strict"?

This is similar to my question in How can I resolve sorbet error: "Use of undeclared variable"?, but for constants. I am experimenting with adding sorbet type i

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?