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
19
votes
2 answers

Rails: What is the location option for in the render method

Hey I am wondering what the location option for the render method in rails is. The docs here http://guides.rubyonrails.org/layouts_and_rendering.html states: "You can use the :location option to set the HTTP Location header:" But I have no idea why…
hajpoj
  • 13,299
  • 2
  • 46
  • 63
19
votes
4 answers

How to embed font-awesome icons into submit_tag

Trying to user font awesome icons for my buttons but I cant get it to show in the submit_tag <%= submit_tag icon("search"), class: "btn-primary", style:"width:40px;" %> output:
ajbraus
  • 2,909
  • 3
  • 31
  • 45
19
votes
4 answers

remove console.log on assets precompile

During assets:precompile the javascript is minified, but console.logs are left in. is there a way to remove all console.logs on precompile when the code is pushed to production?
w2bro
  • 1,016
  • 1
  • 11
  • 36
19
votes
5 answers

Rails, how to migrate large amount of data?

I have a Rails 3 app running an older version of Spree (an open source shopping cart). I am in the process of updating it to the latest version. This requires me to run numerous migrations on the database to be compatible with the latest version. …
akaDanPaul
  • 283
  • 3
  • 9
19
votes
3 answers

Ruby on Rails: How to override the 'show' route of a resource?

Currently I have a route that looks like this: resources :posts I want to override the 'show' action so that I can display a url like this: posts/:id/:slug I am currently able to do this by adding a custom match route: resources :posts match…
Andrew
  • 227,796
  • 193
  • 515
  • 708
19
votes
4 answers

How can I extend ApplicationController in a gem?

I thought I'd come up with a slick way to extend ApplicationController in a Rails 3.x gem. In my gem's lib/my_namespace/my_controller.rb, I had: class MyNamespace::MyController < ApplicationController before_filter :some_method after_filter…
19
votes
5 answers

How do I install Ruby 1.9.3 on Ubuntu without RVM?

I want to install ruby 1.9.3 on Ubuntu without rvm I run sudo apt-get install ruby It's taking ruby 1.8 and ruby 1.9.1. And if I do sudo apt-get install ruby 1.9.3 -p XXXX I am still not able to install ruby. How can I install ruby on Ubuntu?
SSP
  • 2,650
  • 5
  • 31
  • 49
19
votes
2 answers

Rails current_path Helper?

I'm working on a Rails 3.2 application with the following routing conditions: scope "(:locale)", locale: /de|en/ do resources :categories, only: [:index, :show] get "newest/index", as: :newest end I've a controller with the following: class…
Lee Hambley
  • 6,270
  • 5
  • 49
  • 81
19
votes
5 answers

Organization of Locale Files in rails app

I currently have the following 4 files in my config/locales of my root application: -en.yml -de.yml -simple_form.en.yml -simple_form.de.yml In my application.rb which resides in a spec/dummy folder for testing the application gem I have the…
Jay
  • 3,012
  • 14
  • 48
  • 99
19
votes
6 answers

Rails app moved to production server gives "dump format error for symbol" error

I've just moved my rails app from the development to deployment server. I've installed passenger, but I wanted to try with rails s to make sure all was running fine (this is the first time I develop and deploy a rails application). Specs are: Ruby…
user1543863
19
votes
2 answers

Rails change routing of submit in form_for

I have a model 'Article' and a model 'Ratings' nested within articles. /articles/123/ratings I want to change the routing of the f.submit in ratings/_form.html.erb now it is so, that after pressing submit, my application routs to /ratings/111 but I…
Lailo
  • 641
  • 1
  • 8
  • 24
19
votes
3 answers

Prevent ruby on rails 3 from parsing JSON post

I have a controller method in Ruby on Rails 3 that accepts application/JSON as the content type. This all works as expected, but I actually do not want rails to automatically parse the JSON in the body of the POST request. This method is acting as…
Macdiesel
  • 935
  • 1
  • 9
  • 19
19
votes
4 answers

How to clear rails sessions table

I use active record store for rails sessions store. Over just a short time, the size of sessions table has increased a lot. How are these session rows dumped after a certain period of time. Or should I manually clear them once in 24 hours?
Anand
  • 10,310
  • 24
  • 90
  • 135
18
votes
1 answer

Do I need a slash in front of rails route

I have the following url structure in rails routes: match '/financial-dictionary/:letter' => 'learning_center#dictionary', :as => :lc_dictionary Do i need a leading slash in front of "financial-dictionary"? What will happen if i remove it?
Tamik Soziev
  • 14,307
  • 5
  • 43
  • 55
18
votes
7 answers

How do you create prepared statements with the mysql2 gem?

I've tried using google to answer this seemingly simple question, but to my surprise, it didn't help. I have code in my rails application currently using the 'prepare' method with the mysql gem. On switching to mysql2, this breaks with the…
Nikhil
  • 3,042
  • 2
  • 16
  • 16