Questions tagged [ruby-on-rails-3.1]

Ruby on Rails version 3.1.0 is a specific version of Ruby on Rails. It was released on August 30th, 2011. Use this tag for issues related to development in Ruby on Rails version 3.1.

Ruby on Rails version 3.1.0 is a specific version of Ruby on Rails.

Released on August 30th, 2011, it was succeeded by version 3.2.0.

It brings many improvements to the Ruby on Rails web development framework, which is open-source and optimized for programmer happiness and maintaining sustainable productivity. Many things are defined by convention, freeing you from having to re-invent things to stay productive.

Version 3.1 brings many improvements over its preceding version 2, including faster ActiveRecord, assets re-structure, coffeescript, sass, and more.

Further Reading:

Related tag

5270 questions
26
votes
6 answers

Change format of created_at in Rails 3.1?

I am calling the date a record was created at in a basic app running Rails 3.1. <%= @issue.created_at %> The above outputs the following timestamp: 2011-09-10 14:44:24 UTC What is the simplest way of altering the way this displays? I would like…
dannymcc
  • 3,744
  • 12
  • 52
  • 85
26
votes
5 answers

undefined method `database_authenticatable' for #

I am using Active Admin gem for my small application based on Quiz. But when I execute rake db:migrate it gives me error. Following is the trace of the command : $ rake db:migrate RAILS_ENV=production --trace ** Invoke db:migrate (first_time) **…
25
votes
4 answers

How do I use Controller specific stylesheets in Rails 3.2.1?

Using Rails 3.2.1 I created a simple controller called Home using the command: rails g controller Home index And it created a new controller and view for me: Notice how there are two stylesheets, one "Application" and one "Home". I can't find any…
Only Bolivian Here
  • 35,719
  • 63
  • 161
  • 257
25
votes
2 answers

Rails 3.1 Load css in particular order

I see that in development environment in rails 3.1 the css are loaded in alphabetic order and not in the order I want. I want a particular css file to be at the end so it over-writes any styles given to the class before. How can we achieve that?
phoenixwizard
  • 5,079
  • 7
  • 27
  • 38
25
votes
1 answer

Using RequireJS with a Rails 3.1 app

Question If you've used RequireJS with a Rails 3 (esp 3.1) app, how is that working for you? Any configuration tricks or other gotchas that I need to watch out for? Background I'm contemplating using RequireJS over the Sprockets-based Asset Pipeline…
John Whitley
  • 2,030
  • 18
  • 22
25
votes
3 answers

rake assets:precompile is slow

The command "rake assets:precompile" works very slow for me. Especially on my Amazon EC2 Micro production server which does not have a lot of processor resources. On EC2 I have to wait 1 minute or more during each deployment just for this precompile…
Evgenii
  • 36,389
  • 27
  • 134
  • 170
25
votes
2 answers

rails 3.1 ActionController::RoutingError (No route matches [GET] "/assets/rails.png"):

Standard new rails app has issue showing the rails.png ActionController::RoutingError (No route matches [GET] "/assets/rails.png"): I have tried moving the .png file around to various places in assets and assets/images and also the older place…
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
25
votes
5 answers

How do I use Rack::Proxy within Rails to proxy requests to a specific path to another app

I found this great blog post on how to use Rack::Proxy as a separate proxy app. The article explains how he uses Rack::Proxy to proxy requests to http://localhost:3000 to an app on port 3001 and requests to http://localhost:3000/api to an app on…
John
  • 9,254
  • 12
  • 54
  • 75
24
votes
5 answers

Rails counter_cache not updating correctly

Using Rails 3.1.3 and I'm trying to figure out why our counter caches aren't being updated correctly when changing the parent record id via update_attributes. class ExhibitorRegistration < ActiveRecord::Base belongs_to :event, :counter_cache =>…
24
votes
5 answers

Access Main App Helpers when overridings a Rails Engine View/Layout

I have created a simple Rails Engine to provide some general functionality(photo gallery) to an application. I want to be able to override the standard _header partial so that the menu for the gallery matches that of my main application. In my…
24
votes
9 answers

Reflecting Heroku push version within the app

Every time I push my app to heroku I see the line -----> Launching... done, v43 Is there a way to make that version number apear within the app so other people can see that number?
Nick Ginanto
  • 31,090
  • 47
  • 134
  • 244
24
votes
4 answers

Is it possible to force generation of assets with Rails Asset Pipeline?

Is there a way to force regeneration of assets every request when using the Rails 3.1 Asset Pipeline? I am having problems getting the system to pick up changes to files when using Less (less-rails) with a series of partials and mixin files. If I…
Toby Hede
  • 36,755
  • 28
  • 133
  • 162
24
votes
6 answers

Listing 'rake routes' for a mountable Rails 3.1 engine

I'm working on a mountable engine for use with Rails 3.1, and I want to list the engine's routes. I created the engine using: $ rails plugin new rails_blog_engine --mountable And edited the 'test/dummy/config/routes' file to…
emk
  • 60,150
  • 6
  • 45
  • 50
24
votes
1 answer

ruby on rails add a column after a specific column name

I tried to add a column to a table after a specific column in the table. Here is what I did: rails generate migration add_reaction_id_to_patient_allergies reaction_id: integer :after => 'patient_id' Here is what my migration file looks like: class…
24
votes
7 answers

Get Content Type of Request

To find the incoming content type, docs say: request.headers["Content-Type"] # => "text/plain" But I found by trial-and-error, that doesn't work, but this does: request.headers["CONTENT_TYPE"]=='application/json' So what's the most…
mahemoff
  • 44,526
  • 36
  • 160
  • 222