Legacy version of the Ruby on Rails web development framework.
Questions tagged [ruby-on-rails-2]
746 questions
0
votes
0 answers
undefined method `job_joining_date' for nil:NilClass
I am working in rails 2, I have one table users and other table lms_users. In lms_users table, id from users table is coming as foreign key.
Association in users model
has_one :lms_user
has_one :group_detail , :through => :lms_user
Association in…

Bilal Ahmed
- 423
- 1
- 6
- 11
0
votes
2 answers
Find and order by association's associated counter_cache
I have a number of associated models:
Company has_many :clients (which belongs_to :company)
Client has_many :groups (which belongs_to :client)
Group has_many :orders (which belongs_to :group, :counter_cache => true)
Now, I need to find all…

d3vkit
- 1,942
- 1
- 24
- 36
0
votes
1 answer
Rails validation message is treating percentage signs and double periods oddly
Using Rails 2.3.4, Ruby 1.8.7.
I have an ActiveRecord validation where I want to include the user's input in the error message. The simplified version of I'm doing something like this:
record.errors.add attr, "'#{calculated_value}' is not…

jb_314
- 1,373
- 2
- 17
- 28
0
votes
2 answers
undefined method when returning an array in object.find(:all, :conditions)
I'm using:
rails 2.3.9
ruby 1.9.3
windows 7 ultimate
rubygems 1.8.24
This works:
@inventories = Inventory.find :first, :conditions => {:siteId => params[:siteId]}
This doesn't
@inventories = Inventory.find :all, :conditions => {:siteId =>…

Aldrin Dela Cruz
- 205
- 1
- 4
- 15
0
votes
1 answer
How to manange projects that doesn't have gem file?
Under Rails 2 projects doesn't have the gemfile.
In this case which is the best way to manage the gems?, which gems should I vendor? also I will like to know if there's another way to manage this?

M.Octavio
- 1,780
- 2
- 25
- 39
0
votes
1 answer
Find by has_many models size
I'm developing Rails 2.3.8 Ruby 1.8.7 and PostgreSQL.
When I want to search model which has less than specific size, how to write find conditions?
For example, I want to search Topic which has less than 5 comments.
class Topic < ActiveRecord::Base
…

DIGITALSQUAD
- 3,384
- 3
- 22
- 24
0
votes
0 answers
Complex find conditions includes ''include"
I'm developeing with Rails 2.3.8 Ruby 1.8.7 and PostgreSQL.
I want to search records by relation.
UserGuildMaster
class UserGuildMaster < ActiveRecord::Base
has_one :leader, :foreign_key => 'guild_id', :class_name => 'UserGuildLog', :conditions…

DIGITALSQUAD
- 3,384
- 3
- 22
- 24
0
votes
1 answer
Migrating Rails 2.3.5 to Rails 3.x.x Steps With PitFalls and Traps
Update: The Question is Still Open, any reviews, comments are always welcome
As I already know lot QA's in stackoverflow regarding my topic, but most of them are closed and not properly answered.
Question 1) Steps for Migrating Rails 2.3.5 to Rails…

Sam
- 685
- 12
- 34
0
votes
1 answer
Downgrading a Rails 3 App to Rails 2
I've run into a problem today. I've spent the past couple of months building a fairly intensive Rails 3 App that uses all the latest versions of every gem I need. I've just been informed that I can't use anything new. I'll be adding my project in…

XML Slayer
- 1,530
- 14
- 31
0
votes
2 answers
what is the difference between named_scope and method?
named_scope or scope how difference with class method.
named_scope :active, :conditions => {:status => 'Active'}
def self.active
self.find(:all, :conditions => {:status => 'Active'}
end
Whats the difference between the two?

user1577305
- 11
- 1
0
votes
1 answer
Ruby programming - avoid code duplication when named scopes are used
I have multiple named scopes in my model. They have different names but same parameters.
Now, when I use these named scopes based on a condition I have to duplicate the entire parameters all the time. Is there anyway to avoid that?
For ex:
In my say…

Vamsi Krishna
- 3,742
- 4
- 20
- 45
0
votes
1 answer
Rails 2.3 + Ruby 1.8.7 incompatible character encodings: UTF-8 and ASCII-8BIT
I've been having this problem in the index.rhtml of our app. Basically, I have a dynamic div in the page w/c displays all the information of the currently signed in user's projects.
Here is a snippet where the error occurs:
<% projects.each do |p|…

Normz
- 271
- 1
- 2
- 9
0
votes
2 answers
Modifying the returned value of find_by_sql
So I am pulling my hair over this issue / gotcha. Basically I used find_by_sql to fetch data from my database. I did this because the query has lots of columns and table joins and I think using ActiveRecord and associations will slow it down.
I…

r2b2
- 1,255
- 5
- 13
- 34
0
votes
1 answer
Upgraded from Rails 2.3.5 to 2.3.11 and am getting this error now: "uninitialized constant AssignmentsPresenter::OrderedHash
After upgrading, when I try to login to my Rails app, I get the following:
NameError in ApplicationsController#index
uninitialized constant AssignmentsPresenter::OrderedHash
RAILS_ROOT: /Users/jasonbodak
Application Trace | Framework Trace | Full…

Jason Bodak
- 123
- 1
- 2
- 10
0
votes
1 answer
Is it possible to define the inherited hook for the ActionController::Base class in Rails 2.3.11
I am trying to implement the inherited method for ActionController::Base class. My purpose is to call methods on classes that inherit from ActionController::Base like ApplicationController to make them include certain modules.
At the momement my…