Skip to main content
840 votes
18 answers
588k views

How do I generate a random number between 0 and n?
Mark A. Nicolosi's user avatar
431 votes
20 answers
180k views

I ran into an issue in my Rails 4 app while trying to organize JS files "the rails way". They were previously scattered across different views. I organized them into separate files and compile them ...
emersonthis's user avatar
  • 33.6k
150 votes
29 answers
460k views

Before anything, please note that I have found several similar questions on Stack Overflow and articles all over the web, but none of those helped me fix my issue: PG Error could not connect to server:...
Thibaud Clement's user avatar
647 votes
6 answers
249k views

The default Rails 4 project generator now creates the directory "concerns" under controllers and models. I have found some explanations about how to use routing concerns, but nothing about controllers ...
yagooar's user avatar
  • 16k
371 votes
8 answers
415k views

A user has many uploads. I want to add a column to the uploads table that references the user. What should the migration look like? Here is what I have. I'm not sure if I should use (1) :user_id, :...
Don P's user avatar
  • 64.3k
218 votes
19 answers
174k views

There's a strange issue with Rails 4 on Heroku. When images are compiled they have hashes added to them, yet the reference to those files from within CSS don't have the proper name adjusted. Here's ...
Nick ONeill's user avatar
  • 7,421
440 votes
5 answers
350k views

Where can I find a list of data types that can be used in Ruby on Rails 4? Such as text string integer float date I keep learning about new ones and I'd love to have a list I could easily ...
Nicolas Raoul's user avatar
110 votes
21 answers
50k views

Im trying to install an open source rails 3.2.21 application that uses the mysql2 gem, but when i try and run the bundle commant I get the following error: Fetching: mysql2-0.3.18.gem (100%) Building ...
zenvelope's user avatar
  • 1,324
155 votes
20 answers
303k views

I'm setting Rails 4 application with Ruby 2.0, but I'm getting "Web application could not be started" and get this trace: cannot load such file -- bundler/setup (LoadError) /usr/local/lib/ruby/...
Mr_Nizzle's user avatar
  • 6,714
360 votes
6 answers
179k views

In rails >4.0.0 generators creates CRUD operations with before_action not before_filter. It seems to do the same thing. So what's the difference between these two?
freemanoid's user avatar
  • 14.8k
427 votes
4 answers
182k views

Is there an alternative to update_attributes that does not save the record? So I could do something like: @car = Car.new(:make => 'GMC') #other processing @car.update_attributes(:model => '...
tybro0103's user avatar
  • 49.9k
191 votes
15 answers
202k views

I created a Rails application, using Rails 4.1, from scratch and I am facing a strange problem that I am not able to solve. Every time I try to deploy my application on Heroku I get an error 500: ...
Paolo Laurenti's user avatar
89 votes
17 answers
90k views

I just installed Rails 4.0.2 and when creating a new app, in the bundle stage I get: Installing pg (0.17.1) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/...
Deekor's user avatar
  • 9,519
211 votes
3 answers
115k views

I have a Release model with medium and country columns (among others). There should not be releases that share identical medium/country combinations. How would I write this as a rails validation?
Jackson Cunningham's user avatar
390 votes
5 answers
64k views

I just updated to rails 4.0.2 and I'm getting this warning: [deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you ...
Mauricio Moraes's user avatar

15 30 50 per page
1
2 3 4 5
2446