Questions tagged [ruby-on-rails-2]

Legacy version of the Ruby on Rails web development framework.

746 questions
0
votes
1 answer

Cannot modify association because the source reflection class is associated via :has_many

My associations in a Rails 2 project are as follows: class Role < ActiveRecord::Base belongs_to :user has_many :attrs, :through => :user, :dependent => :destroy end class User < ActiveRecord::Base has_many :roles, :order => 'id DESC',…
0
votes
1 answer

Does Ruby on Rails support document relative paths?

As far as I can tell url helpers in Ruby on Rails only generate site root relative paths. So if I want to go from http://exemple.com/categories/1 to http://exemple.com/questions/12 the link will be /questions/12 (site root relative path). Are…
0
votes
1 answer

Why isn't Rails recognizing nil if blank in my form?

I'm reworking a Rails 2 website. Right now, I'm getting an error, and I think it's because a value is being submitted as blank instead of .nil. However, my attempts to keep it nil don't seem to be working. I appreciate any help you have to…
KDP
  • 634
  • 1
  • 11
  • 31
0
votes
2 answers

How do I set a selected option in this Rails 2 selection form?

I am editing a Rails 2 application. In it, a user submits a form that includes a dropdown menu, and that information creates a record in my database. When the user goes to edit the record, I want to show the saved "selected" option in the dropdown…
KDP
  • 634
  • 1
  • 11
  • 31
0
votes
1 answer

Can't get sibling element text with jQuery

I have the following markup: …
martincarlin87
  • 10,848
  • 24
  • 98
  • 145
0
votes
0 answers

Serialize column always returning string

I'm migrating a project from 2 to 2.3.18. I have a value column(col_type = text) which is serialized.when I store integer also its returning string. May I know what might be the issue. I'm using mysql database. ex: >> a = AppSetting.last =>…
0
votes
1 answer

Rails 2 vs Rails 3: Why are route globs no longer split?

In Rails 2, if I had the following route: get 'show/:user_id(/*tags)' => 'show#tags', :as => 'show_tags' I would expect this back from show/123/foo/bar: params[ :tags ] # [ 'foo', 'bar' ] Now, in Rails 3, it returns: params[ :tags ] #…
Jason
  • 3,379
  • 25
  • 32
0
votes
1 answer

Rails 2 - How to Use a Different Layout for an entire sub-site but still be able to use existing Controllers and Models

I am using Rails version 2.3.14 and I am trying to figure out the best way to use a different layout for an entirely new section of my site but I can't think of the most efficient way to do it. e.g. I have a CRM and everything is…
martincarlin87
  • 10,848
  • 24
  • 98
  • 145
0
votes
1 answer

Cloud 9 IDE and Ruby on Rails

Has anyone successfully created a Ruby on Rails (2.3.8) with Ruby (1.8.7) on the Cloud 9 IDE? I have tried several times, but the lack of documentation is a bit irritating, and every time I attempt to load the version of Ruby on Rails and Ruby that…
gamesfreke
  • 105
  • 1
  • 1
  • 9
0
votes
2 answers

Follow association without loading parent object

I have a class like this: class Project < ActiveRecord::Base has_many :versions, :order => :position end In a controller action, I need to query for a project's versions. I have the project ID. I could simply do a versions =…
sys64738
  • 41
  • 6
0
votes
3 answers

Image url in Css file under stylesheets under public Rails 2.3

I am working with Rails 2.3.5 and I have images in public/images/ which are added into css file named as custom.css #cssmenu ul { background: url(nav-bg.png) repeat-x 0px 4px; height: 69px; } How can i make this read the image which in inside…
Mostafa Hussein
  • 11,063
  • 3
  • 36
  • 61
0
votes
1 answer

Ruby on Rails accessing MySQL results error

In my view I send an ajax request to get the device_ports of a particular device. Previously I used def get_device_ports if params[:id] != '' @device_ports = Device.find(params[:id]).device_ports.all(:order => 'id ASC') output = '
martincarlin87
  • 10,848
  • 24
  • 98
  • 145
0
votes
1 answer

Installing devise on Rails 2.3.5

I am working on rails 2.3.5 , ruby 1.8.7-p302 and I am trying to install devise so I have added gem 'devise' into my Gemfile then bundle install worked fine , then i tried to script/generate devise:install but it fails and i don't know the reason…
Mostafa Hussein
  • 11,063
  • 3
  • 36
  • 61
0
votes
4 answers

show names instead of ids rails

Hello i created 2 tables (categories and employees),both are in a relationship and i want to show category_name(Categories table) in my employees index view instead of id's ****Here is my Categories Table****** class CreateCategories <…
0
votes
1 answer

Rails Association Chains

I have two models, Circuit and Organisation with the following relationship: circuit.rb belongs_to :organisation organisation.rb has_many :circuits circuit_controller.rb ... if params[:id] @circuit = Circuit.find(params[:id]) @backup_circuits…
martincarlin87
  • 10,848
  • 24
  • 98
  • 145
2 0.0