Ruby on Rails is an open-source web development framework written in Ruby. Ruby on Rails follows the principle of convention over configuration, freeing you from having to re-invent things to stay productive. Ruby on Rails 4.0 is now available.
13
votes
1answer
4k views
Ignoring timezones altogether in Rails and PostgreSQL
I'm dealing with dates and times in Rails and Postgres and running into this issue:
The database is in UTC.
The user sets a time-zone of choice in the Rails app, but it's only to be used when ...
156
votes
9answers
61k views
Best way to load module/class from lib folder in Rails 3?
Since the latest Rails 3 release is not auto-loading modules and classes from lib anymore,
what would be the best way to load them?
From github:
A few changes were done in this commit:
Do not ...
156
votes
15answers
47k views
Repairing Postgresql after upgrading to OSX 10.7 Lion
I recently upgraded to OSX 10.7, at which point my rails installation completely borked when trying to connect to the psql server. When I do it from the command line using
psql -U postgres
it ...
62
votes
27answers
46k views
rails error, couldn't parse YAML
After updating the gems I've got this:
/home/megas/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 182 column 9 (Psych::SyntaxError)
from ...
128
votes
8answers
28k views
Undefined method 'task' using Rake 0.9.0
I just updated Rake to the latest version (0.9.0.beta.4) and the rake command ends up with the following error message:
rake aborted!
undefined method `task' for ...
39
votes
6answers
53k views
Facebook how to check if user has liked page and show content?
I am trying to create a Facebook iFrame app. The app should first show an image and if the user likes the page, he will get access to some content.
I use RoR, therefore I can't use the Facebook PhP ...
234
votes
9answers
24k views
How to disable logging of asset pipeline (sprockets) messages in Rails 3.1?
Sprockets tends to be quite verbose in the (dev) log by default under Rails 3.1 (RC1):
Started GET "/assets/application.css" for 127.0.0.1 at 2011-06-10 17:30:45 -0400
Compiled ...
81
votes
7answers
24k views
Remove ActiveRecord in Rails 3
Now that Rails 3 beta is out, I thought I'd have a look at rewriting an app I have just started work on in Rails 3 beta, both to get a feel for it and get a bit of a head-start. The app uses MongoDB ...
42
votes
3answers
23k views
Build vs new in Rails 3
In the Rails 3 docs, the build method for associations is described as being the same as the new method, but with the automatic assignment of the foreign key. Straight from the docs:
...
214
votes
25answers
43k views
No route matches “/users/sign_out” devise rails 3
I've installed devise on my app and applied the following in my application.html.erb file:
<div id="user_nav">
<% if user_signed_in? %>
Signed in as <%= current_user.email ...
77
votes
8answers
23k views
Best way to add page specific javascript in a Rails 3 app?
Rails 3 has some unobtrusive javascript which is pretty cool.
But I was wondering what the best way is to include additional JS for a particular page.
For example, where I might have previously ...
94
votes
5answers
36k views
How to fix the uninitialized constant Rake::DSL problem on Heroku?
I am getting errors similar to the ones in these questions, except mine are occuring on Heroku:
2011-05-30T09:03:29+00:00 heroku[worker.1]: Starting process with command: `rake jobs:work`
...
106
votes
8answers
43k views
Can't find the 'libpq-fe.h header when trying to install pg gem on ubuntu
I am using rails 3.1 pre version. I like to use PostgreSQL but the problem is installing the pg gem. It gives me the following error:
demonchand@system-001:~/exercise/personal/pro$ gem install pg
...
60
votes
6answers
27k views
Rails - Could not find a JavaScript runtime?
I created a new Rails project using rails 3.1.0.rc4 on my local machine but when I try to start the server I get:
Could not find a JavaScript runtime. See here for a list of available runtimes. ...
43
votes
3answers
16k views
Devise form within a different controller
I am using a devise gem for sign_in/sign_out procedures.
I generated views files from devise, using rails g devise views
I saw there was a devise/sessions/new.html.erb file which contained a form ...