Error installing Bundler

Had the same issue and everything is described here: http://railsapps.github.io/openssl-certificate-verify-failed.html tl;dr Recent versions of RVM, the Ruby Version Manager, include a utility to diagnose and resolve errors caused by outdated certificate files. See the article Installing Rails for instructions and advice. The RVM website explains how to install RVM. If you’ve installed RVM, try this: … Read more

Rails 3 / Ruby: ActiveRecord Find method IN condition Array to Parameters single quote issue

Answer updated (twice) to reflect Rails 3+ ActiveRecord syntax Rails 3+ You can use the following syntax: Post.where(user_id: [1,2,3]) And thus: Post.where(user_id: args) Rails 3 or Rails 4 (Original) For completeness, the Rails 3 syntax would be: Post.where(“user_id IN (?)”, [1,2,3]).to_a If args is an Array, then: Post.where(“user_id IN (?)”, args).to_a Or, if args is … Read more

Rails 3.2.8 – How do I get the week number from Rails?

Use strftime: %U – Week number of the year. The week starts with Sunday. (00..53) %W – Week number of the year. The week starts with Monday. (00..53) Time.now.strftime(“%U”).to_i # 43 # Or… Date.today.strftime(“%U”).to_i # 43 If you want to add 43 weeks (or days,years,minutes, etc…) to a date, you can use 43.weeks, provided by … Read more

Libxml2 missing mac os x 10.10

i fiddled around with this for quite a while and the following worked for me.. 1) install libxml2 with homebrew brew install libxml2 2) install the gem via sudo env ARCHFLAGS=”-arch x86_64″ gem install nokogiri:1.6.4.1 — –use-system-libraries –with-xml=/usr/local/Cellar/libxml2/

Initialize two variables on same line

This works, but you should know that it’s only safe for your situation because you’re using the variables for numbers, which are immutable in Ruby. If you tried the same thing with a string, for example, you could end up with some behavior you didn’t expect: ruby-1.9.2-p180 :001 > foo = bar = “string” => … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)