Posts in 2021
-
Most votes on ruby-on-rails questions 2
May 01, 2021 in FAQ
Most votes on ruby-on-rails questions 2. #11 How to drop columns using Rails migration #12 Difference between rake db:migrate db:reset and db:schema:load #13 How to use concerns in Rails 4 #14 Purge or recreate a Ruby on Rails database #15 How to remove a key from Hash and get the remaining hash in Ruby/Rails? #16 Ruby on Rails Server options #17 Begin, Rescue and Ensure in Ruby? #18 `require': no such file to load – mkmf (LoadError) #19 Rails DB Migration - How To Drop a Table? #20 Error installing mysql2: Failed to build gem native extension
Read all the top votes questions and answers in a single page. #11: How to drop columns using Rails migration (Score: 668) Created: 2010-05-14 Last updated: 2019-05-23 Tags: ruby-on-rails, ruby, database, activerecord, rails-migrations What’s …
-
Most votes on ruby-on-rails questions 10
May 01, 2021 in FAQ
Most votes on ruby-on-rails questions 10. #91 Rails: select unique values from a column #92 Convert string to symbol-able in ruby #93 Converting camel case to underscore case in ruby #94 Ruby Bundle Symbol not found: _SSLv2_client_method (LoadError) #95 OO Design in Rails: Where to put stuff #96 How do I explicitly specify a Model's table-name mapping in Rails? #97 Breaking up long strings on multiple lines in Ruby without stripping newlines #98 Learning Ruby on Rails #99 WARNING: Can't verify CSRF token authenticity rails #100 Do rails rake tasks provide access to ActiveRecord models?
Read all the top votes questions and answers in a single page. #91: Rails: select unique values from a column (Score: 252) Created: 2012-03-11 Tags: ruby-on-rails, activerecord I already have a working solution, but I would really like to know why …
-
Most votes on ruby-on-rails questions 1
May 01, 2021 in FAQ
Most votes on ruby-on-rails questions 1. #1 Rails: How can I rename a database column in a Ruby on Rails migration? #2 How to understand nil vs. empty vs. blank in Ruby #3 Why do people use Heroku when AWS is present? What distinguishes Heroku from AWS? #4 How do I get the current absolute URL in Ruby on Rails? #5 Understanding the Rails Authenticity Token #6 How to rollback a specific migration? #7 Getting error: Peer authentication failed for user "postgres", when trying to get pgsql working with rails #8 Can't find the 'libpq-fe.h header when trying to install pg gem #9 How to get a random number in Ruby #10 How to "pretty" format JSON output in Ruby on Rails
Read all the top votes questions and answers in a single page. #1: Rails: How can I rename a database column in a Ruby on Rails migration? (Score: 1499) Created: 2010-01-02 Last updated: 2020-10-28 Tags: ruby-on-rails, ruby-on-rails-3, migration, …
-
Most votes on ruby questions 9
May 01, 2021 in FAQ
Most votes on ruby questions 9. #81 What does ||= (or-equals) mean in Ruby? #82 Ruby: Calling class method from instance #83 Best way to require all files from a directory in ruby? #84 What is the "right" way to iterate through an array in Ruby? #85 gem install: Failed to build gem native extension (can't find header files) #86 How to convert a ruby hash object to JSON? #87 Should I use alias or alias_method? #88 Rails :include vs. :joins #89 Rails 4: before_filter vs. before_action #90 How can I install a local gem?
Read all the top votes questions and answers in a single page. #81: What does ||= (or-equals) mean in Ruby? (Score: 368) Created: 2009-06-15 Last updated: 2014-09-09 Tags: ruby, operators What does the following code mean in Ruby? ||= Does it have …
-
Most votes on ruby questions 8
May 01, 2021 in FAQ
Most votes on ruby questions 8. #71 Rails update_attributes without save? #72 How to map and remove nil values in Ruby #73 Get names of all files from a folder with Ruby #74 Rails I18n validation deprecation warning #75 How can I specify a local gem in my Gemfile? #76 What is the difference between <%, <%=, <%# and -%> in ERB in Rails? #77 Parsing a JSON string in Ruby #78 Ruby, Difference between exec, system and %x() or Backticks #79 String concatenation in Ruby #80 How can I delete one element from an array by value
Read all the top votes questions and answers in a single page. #71: Rails update_attributes without save? (Score: 395) Created: 2011-07-21 Last updated: 2021-03-04 Tags: ruby-on-rails, ruby, ruby-on-rails-3, ruby-on-rails-4, rails-activerecord Is …
-
Most votes on ruby questions 7
May 01, 2021 in FAQ
Most votes on ruby questions 7. #61 How to break out from a ruby block? #62 What is the easiest way to duplicate an activerecord record? #63 How to run Rake tasks from within Rake tasks? #64 Rails 4: List of available datatypes #65 How to update Ruby Version 2.0.0 to the latest version in Mac OSX Yosemite? #66 How do I get the name of a Ruby class? #67 Determining type of an object in ruby #68 How to downgrade or install an older version of Cocoapods #69 Uninstall old versions of Ruby gems #70 How to convert a unix timestamp (seconds since epoch) to Ruby DateTime?
Read all the top votes questions and answers in a single page. #61: How to break out from a ruby block? (Score: 432) Created: 2009-09-10 Last updated: 2016-11-02 Tags: ruby Here is Bar#do_things: class Bar def do_things Foo.some_method(x) do |x| y = …
-
Most votes on ruby questions 6
May 01, 2021 in FAQ
Most votes on ruby questions 6. #51 When to use RSpec let()? #52 Error while installing json gem 'mkmf.rb can't find header files for ruby' #53 Difference between a class and a module #54 Tell Ruby Program to Wait some amount of time #55 What is Ruby's double-colon
::
? #56 Ruby: What does 'require: false' in Gemfile mean? #57 Difference between map and collect in Ruby? #58 Ruby: Can I write multi-line string with no concatenation? #59 How to find a min/max with Ruby #60 What is the difference between include and extend in Ruby?Read all the top votes questions and answers in a single page. #51: When to use RSpec let()? (Score: 459) Created: 2011-03-19 Last updated: 2018-09-17 Tags: ruby, rspec I tend to use before blocks to set instance variables. I then use those variables …
-
Most votes on ruby questions 5
May 01, 2021 in FAQ
Most votes on ruby questions 5. #41 How do you add an array to another array in Ruby and not end up with a multi-dimensional result? #42 Error installing mysql2: Failed to build gem native extension #43 Undo scaffolding in Rails #44 How to redirect to a 404 in Rails? #45 How to Uninstall RVM? #46 How to reverse a 'rails generate' #47 What is the difference between include and require in Ruby? #48 How to map with index in Ruby? #49 Is there a "do … while" loop in Ruby? #50 When monkey patching an instance method, can you call the overridden method from the new implementation?
Read all the top votes questions and answers in a single page. #41: How do you add an array to another array in Ruby and not end up with a multi-dimensional result? (Score: 508) Created: 2009-11-26 Last updated: 2009-11-26 Tags: ruby, arrays, …
-
Most votes on ruby questions 4
May 01, 2021 in FAQ
Most votes on ruby questions 4. #31 How to sum array of numbers in Ruby? #32 How do I pick randomly from an array? #33 How to install a gem or update RubyGems if it fails with a permissions error #34 Begin, Rescue and Ensure in Ruby? #35 Why are exclamation marks used in Ruby methods? #36 What's the difference between equal?, eql?, ===, and ==? #37 Why use Ruby's attr_accessor, attr_reader and attr_writer? #38 What does map(&:name) mean in Ruby? #39 Should Gemfile.lock be included in .gitignore? #40 Ruby: kind_of? vs. instance_of? vs. is_a?
Read all the top votes questions and answers in a single page. #31: How to sum array of numbers in Ruby? (Score: 583) Created: 2009-10-08 Last updated: 2014-02-22 Tags: ruby, arrays, math, sum I have an array of integers. For example: array = …
-
Most votes on ruby questions 3
May 01, 2021 in FAQ
Most votes on ruby questions 3. #21 How to check if a specific key is present in a hash or not? #22 How to "pretty" format JSON output in Ruby on Rails #23 How to drop columns using Rails migration #24 Difference between rake db:migrate db:reset and db:schema:load #25 How to match all occurrences of a regex #26 Ruby function to remove all white spaces? #27 How to write to file in Ruby? #28 How to remove a key from Hash and get the remaining hash in Ruby/Rails? #29 How to remove RVM (Ruby Version Manager) from my system #30 Checking if a variable is defined?
Read all the top votes questions and answers in a single page. #21: How to check if a specific key is present in a hash or not? (Score: 685) Created: 2010-12-24 Last updated: 2020-10-22 Tags: ruby, data-structures, associative-array I want to check …