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
24
votes
3 answers

How do I access Apache error logs via the Terminal in Mac OS X 10.6.8?

I am having trouble with serving up my rails app on a remote computer after upgrading from Rails 3.0 to 3.1. So I want to take a look at what exactly is going wrong when Apache attempts to start up my app and it fails. How can I find the errors that…
pitachip
  • 965
  • 3
  • 7
  • 24
24
votes
1 answer

Dalli vs Redis-Store for Rails App

I have been using Dalli until now for caching and today I came across Redis -Store. I am wondering should I switch to redisstore. My app already uses redis for certain stuff so I have a redis server which is quite big(in terms of resources) and I…
Josnidhin
  • 12,469
  • 9
  • 42
  • 61
23
votes
5 answers

Rails: how to disable before_destroy callback when it's being destroyed because of the parent is being destroyed (:dependent => :destroy)

I have two classes: Parent and Child with Child: belongs_to :parent and Parent has_many :children, :dependent => :destroy The problem is that I want to check that there is always at least one child present, so I have a before_destroy method in…
23
votes
1 answer

ruby on rails 3.1 move .swf to asset pipeline?

Is it possible to move SWF files to the asset pipeline, and if possible how can this be done?
Rubytastic
  • 15,001
  • 18
  • 87
  • 175
23
votes
4 answers

Persisting SCSS variables in rails asset pipeline?

I'm upgrading a rails app with lots of SCSS stylesheets to use the asset pipeline, and need to include some global variables and mixins for each file. Adding several @import directives at the top of every file isn't very DRY, so I'd like to do…
Zubin
  • 9,422
  • 7
  • 48
  • 52
23
votes
5 answers

How can I identify unused i18n keys?

I'm working on an existing Rails app and am using a localization file, en.yml, to hold most of the app's text. At the moment, we aren't localizing into any other languages, so there's just the one file, but the fact that we're putting…
Nathan Long
  • 122,748
  • 97
  • 336
  • 451
23
votes
5 answers

Use LIKE/regex with variable in mongoid

I'm trying to find all documents whose text contains the word test. The below works fine: @tweets = Tweet.any_of({ :text => /.*test.*/ }) However, I want to be able to search for a user supplied string. I thought the below would work but it…
Hinchy
  • 683
  • 2
  • 7
  • 19
23
votes
3 answers

How to get Gzip and Expires Header on a Rails 3.1.1 app on Heroku Cedar?

I'm running a Rails 3.1.1 application on Heroku Cedar. By default this stack doesn't Gzip and set Expires Headers on assets. There is some doc about that, but it's not very clear : http://devcenter.heroku.com/articles/http-routing Can somebody give…
Camille
  • 678
  • 6
  • 23
23
votes
4 answers

blueprint css rails 3.1 help

My blueprint css works on my local machine, but when I push to heroku I get an error. I have blueprint stored in my app/assets/stylesheets folder and here are the stylesheet tags I'm using: <%= stylesheet_link_tag "application" %> <%=…
John
  • 233
  • 2
  • 4
23
votes
5 answers

How to manage CSS Stylesheet Assets in Rails 3.1?

I'm just learning the new asset pipeline in Rails 3.1. One particular problem I'm having is with the way Sprockets just mashes all the found CSS stylesheets into one massive stylesheet. I understand why this is advantageous over manually merging…
Ben
  • 231
  • 1
  • 2
  • 4
23
votes
4 answers

ActiveRecord::ConnectionTimeoutError happening sporadically

Whenever I have an application using ActiveRecord I get this ConnectionTimeoutError - but always after a certain unknown period of time ActiveRecord::ConnectionTimeoutError (could not obtain a database connection within 5 seconds. The max pool size…
22
votes
2 answers

How to rectify versions on has_many/belongs_to association with paper_trail

I use paper_trail in rails to track my models versions. But the documentation on the github repo indicates that the gem doesn't support has_many, belongs_to associations. Let's say I've an app that records the ceos names of some comapnies: class…
blawzoo
  • 2,465
  • 4
  • 19
  • 24
22
votes
2 answers

RVM: specify a ruby version to use

I know how to use RVM, but now I have a weird problem, which I do not understand why. Here is the simple story (I am using Ubuntu): I have created a Rails project, the direcotry of this project is "bookstore/". I go to project directory by cd…
Mellon
  • 37,586
  • 78
  • 186
  • 264
22
votes
5 answers

How can I reference images in the asset pipeline from a model?

I have a model with a method to return a url to a person's avatar that looks like this: def avatar_url if self.avatar? self.avatar.url # This uses paperclip else "/images/avatars/none.png" end end I'm in the midst of upgrading…
21
votes
5 answers

How do I redirect back to a page I'm currently on?

In my users photo album page they see photos they have uploaded and each photo has a 'make default' link on it. When the user clicks make default, then the id of the photo is stored in the photo_id column of my profiles table. The issue is…
LondonGuy
  • 10,778
  • 11
  • 79
  • 151