-
The convenience of Ruby 2.1 def returning a symbol instead of nil
Prior to 2.1, if you defined a method, you received nil as a return value: irb(main):001:0> def fun irb(main):002:1> end => nil With 2.1, the method definition returns a symbol for the method name: irb(main):001:0> def fun irb(main):002:1> end => :fun One impact of this is that the following pattern for declaring a single private…
-
Passing Additional Arguments to FactoryGirl Factories
I wanted to create a factory that would link various states to my model, but from a specified list instead of automatically generated. I discovered that these are transient attributes: FactoryGirl.define do factory :business do name “MyString” # # # trait :with_states do ignore do state_list [] end # add association equal to state code…
-
Bundler reports errors across several different projects when running `bundle install`
When running bundle install, I was getting the following for several projects: Bundler gave the error “Could not find {gem_name_version} in any of the sources” while processing “{project_path}/Gemfile”. Perhaps you forgot to run “bundle install”? . . . I found someone else was having the same problem too. In my case, I had uninstalled and…