Legacy version of the Ruby on Rails web development framework.
Questions tagged [ruby-on-rails-2]
746 questions
0
votes
1 answer
Ruby on Rails - Most Efficient Way to Compare Two Large Arrays for non-matching results
I have some legacy code in my app that compares all table rows for a model with the result of an API call from a supplier.
This worked fine until last week where both the number of table rows and the number of results by the supplier increased…

martincarlin87
- 10,848
- 24
- 98
- 145
0
votes
1 answer
pass selected drop down value as params in rails link_to
I have a select tag which populates list of department names, When I select a value from drop down, I need to display an edit link below (link_to) and append the selected value of dropdown as id params.(I am not using form for this single select tag…

rubyist
- 3,074
- 8
- 37
- 69
0
votes
0 answers
Getting Bootstrap to work in Rails 2
I have worked with Rails 4 earlier and getting bootstrap and sass to work with a Rails 4 application was very easy by doing:
Adding gem 'bootstrap-sass' and gem 'sass-rails', '~> 4.0.0' to the Gemfile and running bundle install
Add //= require…

Varun Natraaj
- 7,402
- 2
- 18
- 19
0
votes
2 answers
Multiply column values in ruby on rails
I am a total noob at ruby on rails so what I am trying to do is multiply the value of each row in two columns together and store it in a new object. I know how I would do it in mysql but when I do something like this in my .erb file
@ordertotals =…

user2793027
- 83
- 1
- 3
- 15
0
votes
2 answers
Error trying to put a conditional in arrays
I'm using ruby 1.8.7
Hello everybody i'm trying to put a conditional in an array but i'm getting an error.
I want
if policy.date_ini >= insurance.initial_date then
do sum of all net_ensurance where date_ini >= initial_date
else
…

Carlos Morales
- 1,137
- 3
- 15
- 38
0
votes
3 answers
Issue showing a value from array
I wrote an app to get the last_insurance value and sum but I'm getting "undefined method `total' for nil:NilClass" in my view.
My tables are:
|policies|
ID POLICY_NUM DELETED STATE POLICY_BUSINESS_UNIT_ID
1 1234 0 …

Carlos Morales
- 1,137
- 3
- 15
- 38
0
votes
1 answer
Issue after doing a query, I'm getting other values in my view
I wrote an app in Rails and created a query to count the last_insurance and sum by type_money but when I show it in my text_field_tag I'm getting another value:
#######this error is inside my text_field_tag
#
Here is…

Carlos Morales
- 1,137
- 3
- 15
- 38
0
votes
2 answers
Grouping and counting information in table relationship issue
I did an app to show a the last net_insurance and count in Insurance Financing but i'm trying to group and count when is expired and not expired
Here my tables
|policies|
|id| |num_policy|
1 12345
2 54654
|insurances|
|id| …

Carlos Morales
- 1,137
- 3
- 15
- 38
0
votes
1 answer
Counting in table with relationship issue
I did an app to show a the last net_insurance but when i try to count in Insurance Financing
Here my tables
|policies|
|id| |num_policy|
1 12345
2 54654
|insurances|
|id| |id_policy| |net_insurance|
1 1 1000
…

Carlos Morales
- 1,137
- 3
- 15
- 38
0
votes
1 answer
Counting in the view issue?
I'm working with Ruby on Rails, and wrote an application to count results in my view, but it is not working.
Here are my tables:
|policies|
|id| |num|
1 1234
2 5678
3 1551
|debts|
|id| |policy_id|
1 1
2 1
3 …

Carlos Morales
- 1,137
- 3
- 15
- 38
0
votes
2 answers
Ruby on Rails - Method Name Identical to ActiveRecord Method
In my Rails model I have a description method:
def description
if self.channels.nil?
return self.allowed_ip_addresses
else
return self.channels.to_s + ' channels - ' + self.allowed_ip_addresses
end
end
I have quite a few models where…

martincarlin87
- 10,848
- 24
- 98
- 145
0
votes
1 answer
Sum last values of each column issue
I did an app to sum the last values of each column but i'm getting the total sum
Here my tables
|policies|
|id| |num_policy|
1 1234
2 4567
|insurances|
|id| |id_policy| |net_insurance|
1 1 4000
2 1 …

Carlos Morales
- 1,137
- 3
- 15
- 38
0
votes
2 answers
Rake db:migrate error while upgrade from rails2 to rails3
I have upgrade rails2 to rails3 and when i try to rake db:migrate I have found following error
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
DEPRECATION WARNING: The InstanceMethods module inside…

jai lalawat
- 73
- 1
- 11
0
votes
1 answer
Rails 2.3.8 Compound condition
I have a rails query that I would like to run. The only problem that I am having is the query structure.
Essentially the query looks like this
queryList = model.find(:all, :conditions => [id = "id"])
#returns a query list
#here is the…

Michael Guantonio
- 409
- 1
- 6
- 14
0
votes
1 answer
Basic commands of rails 2.3.5
I started in rails with version 2.3.5 with a tutorial. Some of the commands do not work, for example:
$ rails generate controller welcome index
This does not work as the tutorial is using another version. Can some one suggest the basic commands…

Vipin Raj
- 26
- 6