Questions tagged [ruby-on-rails-2]

Legacy version of the Ruby on Rails web development framework.

746 questions
5
votes
2 answers

Session management in Rails (2.3)

Apparently, after upgrading to Rails 2.3 my session storage has stopped working. I used to have this: session :session_expires => 3.years.from_now in my application_controller.rb, but now every time i close the browser (chrome) the session expires.…
JussiR
5
votes
1 answer

Can't run rails 2.x app

I try to run 2.x application. I use rvm and set for this application other version of ruby: $ rvm use ree-1.8.7-head I try to run server and then i get a lot of errors: $ script/server NOTE: Gem.source_index is deprecated, use Specification.…
ExiRe
  • 4,727
  • 7
  • 47
  • 92
4
votes
2 answers

setting primary key for a database not named ":id"

I am using: rails 2.3.5 ruby 1.8.7 and Windows 7 Home Basic I was given a database and I connected it to rails, having no problems reading and getting data from it. Now what I want to do is add some functionality in it (add, edit and delete) but…
Aldrin Dela Cruz
  • 205
  • 1
  • 4
  • 15
4
votes
2 answers

Prevent database rollback in specs in Ruby on Rails?

When running RSpec tests in Ruby on Rails 2.3 with ActiveRecord, the database gets rolled back to the state after a before :all block after each example (it block). However, I want to spec the lifecycle of an object, which means going through a…
Nicos
  • 171
  • 1
  • 6
4
votes
3 answers

Setting up Capybara for Rails 2.3 and Rspec

I'm having some trouble setting up capybara (0.4.1.2) in a rails 2.3.8 app with Rspec 1.3 From the installation capybara instructions, I've inserted the line: require 'capybara/rspec' However that gives me a missing constant error. Seems like…
existentialmutt
  • 446
  • 5
  • 12
4
votes
3 answers

Failed to push to Heroku (Ruby 2.3.4)

I keep getting this error while trying to push to heroku. Didn't have any problem a couple of days ago and I made no changes to my gemfile. Here is the error that I'm getting when I push to heroku. It says "An error occurred while installing…
Stella Han
  • 161
  • 1
  • 7
4
votes
2 answers

How does ActiveRecord implement `:if => ...` on validations

I've been looking through the ActiveRecord source to find out how :if => proc_or_method_name works on ActiveRecord validations, but the only instances of :if in the source are in the comments explaining how the feature should be called. For example,…
Gareth
  • 133,157
  • 36
  • 148
  • 157
4
votes
1 answer

ActionMailer fails with "undefined function" when called from delayed job

So if I try sending an email with action mailer directly, I can use all application helpers like url_for, content_for etc, but when I try to do the exact same action [sending email] with delayed_job [send_later] I getting a delayed job fail, of…
Savvas
  • 41
  • 1
4
votes
2 answers

Using named_scope with counts of child models

I have a simple parent object having many children. I'm trying to figure out how to use a named scope for bringing back just parents with specific numbers of children. Is this possible? class Foo < ActiveRecord::Base has_many :bars …
4
votes
1 answer

How can do calculations in ajax update div?

I did an application using javascript to multiply a quantity with price but is only working with the first row. Here is the controller: def index @products= CustomerProduct.all end def selected_product @selected_product =…
Carlos Morales
  • 1,137
  • 3
  • 15
  • 38
4
votes
1 answer

stale association data on ActiveRecord model instance?

I'm using Rails 2, and I have a one-to-many association between the Project model and the Schedule model in this app. I have an observer check when attributes of various things change, and in response, it iterates over an array of hashes with which…
ryanmrubin
  • 728
  • 4
  • 11
4
votes
2 answers

How to upgrade Rails app from 2.3.5 to 3.2.x?

I have Rails 2.3.5 app, I want to upgrade to 3.2.x. How do I upgrade to Rails 3.2.x? Thanks
4
votes
2 answers

running multiple rails websites using phusion passenger 3.0.17 with nginx

I searched google for deploying multiple rails websites using phusion passenger 3.0.17 with nginx but I didn't get relevant results. Any how I completed passenger nginx setup by running passenger-install-nginx-module command. Ques 1) I am looking…
Sam
  • 685
  • 12
  • 34
4
votes
1 answer

Association named was not found

I am working in Rails 2. I have three tables: users, lms_users and group_details. In lms_users id from users and group_details is coming as foreign keys. lms_users has its own attributes as well. I am unable to define association in their respective…
Bilal Ahmed
  • 423
  • 1
  • 6
  • 11
4
votes
3 answers

Reverse Engineering (Generating) Tables or Database Schema from Models and Views in Ruby on Rails

Update: The Question is Still Open, any reviews, comments are always welcome I am having an existing rails project in which some important files and directories has been missed. project rails version (2.3.8) i found it in environment.rb currently…