Questions tagged [ruby-on-rails-2]

Legacy version of the Ruby on Rails web development framework.

746 questions
1
vote
1 answer

rails2 nested namespace with root path to different controller

In rails 3.1.1, I have admin_root_path set in my routes.rb as: namespace :admin do root :to => "base#index" resources :users end Which routes to the index action on the admin/base_controller. But for reasons beyond my control, I have to…
h8windows
  • 91
  • 1
  • 8
1
vote
3 answers

default scoping confusion

UPDATED: I am setting default scope for some models in a runtime which seems working locally in my development env and my code is given below. SET_OF_MODELS = [Event, Group, User] @account =…
ashisrai_
  • 6,438
  • 2
  • 26
  • 42
1
vote
2 answers

Log changes to Database

I have around 15 more or less complex models. Of those I would like to track the changes. What's the simplest way? After-save/-update triggers? Performance is important but if there is a way with low complexity but decreasing performance, I'll do…
Philip
  • 3,470
  • 7
  • 29
  • 42
1
vote
2 answers

Can't create new project in Ruby on Rails

After insatlling rails through rvm, when i create new project rails new project_name creats project with name "new" not with "project_name", but folder contain all project files, after that i try to start server with command rails server or rails…
pirelly
  • 465
  • 5
  • 17
1
vote
1 answer

Apache/Passenger reverse proxy to Passenger standalone not working

I want to run rails 3 and rails 2.3.8 apps on the same machine. I currently have Passenger setup with Ruby 1.9.2 for my rails 3 apps and that is working fine with Apache. I found the following at the Phusion website and am trying out the reverse…
nexar
  • 11,126
  • 3
  • 29
  • 32
1
vote
1 answer

Having trouble passings params to embedded action in view

Working on some legacy code (Rails v2.3) and I've become stuck. I have a view that uses the embed tag to run an action that produces a PDF. Copying code from the other working view in my project, I have the embed code link to the controller…
Homsta
  • 13
  • 3
1
vote
3 answers

ActionMailer 2.3.8 is sending all of my mail in HTML format, regardless of what I do

I'm have a Rails 2.3.8 app, with a notifier in app/models/hello_notifier.rb that looks like this: class HelloNotifier < ActionMailer::Base def hello_world @recipients = 'to@email.address' @from = 'from@email@address' …
Ben Lee
  • 52,489
  • 13
  • 125
  • 145
1
vote
1 answer

Hide a submit_tag in Rails 2.3 by default

I wanted to have the submit_tag in rails 2.3 hidden by default i.e. get style="visibility:hidden" in the html output for the submit_tag. I searched the APIs but wasn't of any help. I tried sth. like <%= submit_tag 'Save', :id=>"submitBtn"+i.to_s,…
rStarter
  • 13
  • 4
1
vote
2 answers

How do i get Rails to route to a controller instead of a static file in the public folder?

In a Rails 2.3 app I have a SitemapController with a sitemap action that creates a human-readable sitemap page, and a route to that in the routes file. In the public folder there's a sitemap.xml file for search engines. The problem is that…
Mori
  • 27,279
  • 10
  • 68
  • 73
1
vote
1 answer

Assign Associated Record Without Eval (Rails 2.x)

My code looks like this # record[field_name] = get_children(field_name) eval "record.#{field_name} = get_children(field_name)" record is an ActiveRecord subclass, and the field in question is a has_a relationship. The commented line does…
Dan Rosenstark
  • 68,471
  • 58
  • 283
  • 421
1
vote
1 answer

ActiveRecord returns model objects with un-initialized associations

I have a simple join query which in some cases returns ActiveRecord objects with uninitialized associations, and I try to understand why. (My setup: rails 2.3.8 with MySQL) Here are my models: class Member has_many :twitter_status_relations //has…
Ran
  • 3,455
  • 12
  • 47
  • 60
1
vote
3 answers

Not recognized by the 'identify' command error while using validates_each

Below is my validations for image content type which works fine. validates_attachment_size :icon, :less_than => MAX_SIZE.megabytes, :message => "Max size is 1 mb" validates_attachment_content_type :icon, :content_type => ['image/jpg','image/jpeg',…
ashisrai_
  • 6,438
  • 2
  • 26
  • 42
1
vote
1 answer

RVM install 1.8.7 on Monterey 12.0.1 Fails

Has anyone gotten ruby 1.8.7 working on Monterey with RVM? I've tried every solution reported out there and nothing seems to work for me. I know 1.8.7 is totally deprecated and unsupported but there are many out there still on this version. RVM…
oprogfrogo
  • 2,005
  • 5
  • 31
  • 42
1
vote
1 answer

What should a Rails 3.x noob know about maintaining a Rails 2.3 app?

I recently learned Rails (Rails 3 to be specific) and got a small project maintaining a Rails 2.3.2 app. So, as you might expect, I keep running into differences between what I learned in Rails 3 and what I'm working in. For example 'rails server'…
John MacIntyre
  • 12,910
  • 13
  • 67
  • 106
1
vote
1 answer

Rails 5: How to convert this named_scope to a scope

Simple question I hope. How do I convert this named_scope line from a rails 2 app into a scope line for rails 5 original... named_scope :effective_on, lambda { |date| { :conditions => ['(effective_on IS NULL OR effective_on <= ?) AND…
thefonso
  • 3,220
  • 6
  • 37
  • 54