Questions tagged [ruby-on-rails-3]

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. Use this tag only for Rails 3-specific questions, and also tag those questions [ruby-on-rails].

Ruby on Rails 3.0 was a major revision of Ruby on Rails in 2010, the open-source web development framework designed to make programmers happy and productive. Rails 3.0 brings a bunch of new features and improvements over older Rails versions, including:

  • Brand new router with an emphasis on RESTful declarations
  • New Active Record chainable query language built on top of relational algebra
  • Unobtrusive JavaScript helpers with drivers for Prototype, jQuery
  • Explicit dependency management with Bundler

See Ruby on Rails 3.0 Release Notes for more information.

Multiple sub-versions have been released, namely 3.0, 3.1 and 3.2. Questions regarding specific sub-versions of Ruby on Rails 3.0 can also be asked on the appropriate tags:

Resources:

See also:

56082 questions
18
votes
1 answer

Ruby on Rails guides document on Activerecord association incorrect?

Wow I've been struggling with this for whole day, following the "official" ruby on rails guides document, and just discovered that I might have been misguided by the document all along. I just want to confirm if this is true. If you go to…
Vlad
  • 8,038
  • 14
  • 60
  • 92
18
votes
2 answers

how to render rails static 404, 500 error pages without site layout?

I'm using rails 3. In production rails nicely handles exceptions and loads my static 404.html, 500.html etc files from my public directory. However, it loads these files into my layouts/application.html.erb file. I am looking for a way to instruct…
istan
  • 1,349
  • 3
  • 21
  • 36
18
votes
3 answers

"rake aborted! stack level too deep" while deploying to Heroku

My website used to be working and Heroku precompiled the assets and everything. Now, seemingly out of nowhere, I started to get this message on deploy: Preparing app for Rails asset pipeline Running: rake assets:precompile mkdir -p…
Ashitaka
  • 19,028
  • 6
  • 54
  • 69
18
votes
1 answer

PUT method form_for

I am using the following to try and set a PUT method on the form but it is still doing a post. I have referred to the docs and it seems like im doing this right. form_for @firm, html: {autocomplete: "off"}, url: firm_path, method: :put do |f| ...
Jason Waldrip
  • 5,038
  • 8
  • 36
  • 59
18
votes
5 answers

How can I run SOME initializers when doing a Rails assets:precompile?

Background I have an app that I recently updated to Rails 3.2.1 (from Rails 3.0.x) and have refactored the JS and CSS assets to make use of the new asset pipeline. The app is hosted on Heroku with the Celadon Cedar stack. App Config I keep…
18
votes
4 answers

Validate uniqueness of in association

Given the following classes: class Candidate has_many :applications has_many :companies, :through => :job_offers end class JobOffer belongs_to :company end class Application belongs_to :candidate belongs_to :job_offer end How can I…
user1163964
  • 183
  • 1
  • 1
  • 5
18
votes
2 answers

Login Failure when Testing with Capybara, Rspec and Selenium in Rails 3.1

I added some confirmation dialog boxes for my Rails 3.1 application and, prior to that, their corresponding tests. Following the model of Railscast #257, I added ':js => true' to the test, added database_cleaner and modified the spec_helper.rb file…
JHo
  • 1,068
  • 1
  • 14
  • 29
18
votes
3 answers

Rails 3 http_basic_authenticate_with only in production environment?

is there a way to only use http_basic_authenticate_with :name => 'user', :password => 'secret' when the server is running on production mode?
Cojones
  • 2,930
  • 4
  • 29
  • 41
18
votes
3 answers

Rails scope find with current user

I'm using Rails 3 with Devise for user auth. Let's say I have a User model, with Devise enabled, and a Product model, and that a User has_many Products. In my Products controller I'd like my find method to be scoped by current_user, ie. @product =…
ideaoforder
  • 1,023
  • 2
  • 9
  • 23
18
votes
1 answer

When does Rails compile CoffeeScript?

When does Rails compile Coffeescript resources to JavaScript? Does it happen on-demand or at startup?
alexs333
  • 12,143
  • 11
  • 51
  • 89
18
votes
2 answers

Backbone.js - Coffeescript extends

I'm making chaining selects with backbone.js by this article http://blog.shinetech.com/2011/07/25/cascading-select-boxes-with-backbone-js/, but got errors, when extending classes. So, i have LocationsView class: class Blog.Views.LocationsView…
BazZy
  • 2,429
  • 3
  • 21
  • 26
18
votes
7 answers

Rake task to truncate all tables in Rails 3

I would like to have a rake task for truncating all the tables. I have found one on the internet, but it is supposed only for Rails 2 and does not work for Rails 3 (problem is in getting a database connection). rake db:reset is not an option,…
lzap
  • 16,417
  • 12
  • 71
  • 108
18
votes
4 answers

How to authenticate iOS/iPhone users with remote web application and re-use authentication ticket in future requests to the same web application?

I am building an iOS application and I need to be able to make authenticated requests to a Rails 3 application for various bits of data. The Rails 3 application is using omniauth and URLs like https://myapp.com/auth/facebook to, for example,…
wgpubs
  • 8,131
  • 15
  • 62
  • 109
18
votes
6 answers

Rails 3 test fixtures with carrierwave?

I'm working on upgrading from attachment_fu to carrierwave, since attachment_fu is broken in rails 3. None of the tests are able to run, because we have invalid fixtures that were using the syntax from attachment_fu for attachment files. For…
18
votes
14 answers

Rails 3.1 issue with javascript_include_tag in application.html.erb

I've created a clean and simple Rails 3.1 application called demo1. It contains two controllers - hello and goodbye. I get the following error when I try to load http://localhost:3000/say/hello: ActionView::Template::Error ( (in…
ryan
  • 5,039
  • 13
  • 35
  • 42