Questions tagged [ruby-on-rails-2]

Legacy version of the Ruby on Rails web development framework.

746 questions
2
votes
1 answer

Multi type search with independent filters in elasticsearch

I have a separate index for each account, in which the mappings for each model (user and comments - just an example, actual app has many models) are specified. include Tire::Model::Search Tire.index('account_1') do create( :mappings => { …
Vamsi Krishna
  • 3,742
  • 4
  • 20
  • 45
2
votes
0 answers

Is this Active Record (2.3) query correct and complete?

I have some associated models (Rails 2): class User < ActiveRecord::Base has_many :proposals, :dependent => :destroy end class Proposal < ActiveRecord::Base belongs_to :user has_many :proposal_sections, :dependent => :destroy end class…
Leszek Andrukanis
  • 2,114
  • 2
  • 19
  • 30
2
votes
1 answer

Ruby's `File.exist?` ThreadError

I am encountering errors when I am using Ruby's File.exist? method in middleware. I have no idea why. This is the background. I am improving some old webapp which hosts around 100GB of photos and growing. I need to replicate production environment…
skalee
  • 12,331
  • 6
  • 55
  • 57
2
votes
0 answers

Use paperclip to convert pdf to jpg using ghostscript

I am trying to use the following script to generate jpgs for pdf files without success. https://gist.github.com/3059321 I am hoping someone can provide me with a little bit of assistance in making it work. I have spent quite a bit of time struggling…
2
votes
0 answers

API Versioning in Rails 2 project

I've got a project running using Rails 2.3.14 and Ruby 1.8.7. I'd like to implement a versioning system for our RESTful API similar to what is shown in http://railscasts.com/episodes/350-rest-api-versioning. I am finding some difficulties…
2
votes
1 answer

DelayedJob fails silently when couldn't connect to database

So, i have a big rails application that is using delayed_job to send emails and SMS to the users. Once in a while, the delayed_job process will simply stop working without any message on the logs. I have finally pinpointed the problem as the…
gabrielrios
  • 554
  • 1
  • 4
  • 12
2
votes
0 answers

Rails 2 plain text mail showing wrong indentation/format in Thunderbird

I am using rails 2.3 and want to send multipart plain/html emails. The html emails gets delivered in proper format, but the text emails shows wrong format sometimes. This is my notifier method: part :content_type => 'multipart/alternative' do…
2
votes
1 answer

How to kill process in ruby on rails after a specific time (like 2 seconds)?

What I want to do is... I have used PAPERCLIP to upload the file in server. for this i have used some shell scripts. now i want that when user browses for a file and clicks on upload button then from that moment i want to record time. and if process…
Sonal S.
  • 1,444
  • 1
  • 15
  • 31
2
votes
1 answer

rails - mysql joining multiple tables

I am trying to do a basic report here Show a list of users with details like names, age etc. Also show other details like number of posts, last activity time etc. All these other details are in a has_many relation from users This is what I am…
ZX12R
  • 4,760
  • 8
  • 38
  • 53
2
votes
2 answers

validate method call on Create only, not for on update

I have validate method in my model def validate super if some condition errors.add('', 'some text') end end This method call on Create and Update. I don't want to call on Update. How can I do that? I am using rails2.3.11 and…
user1413365
2
votes
1 answer

How to update attribute that is being validate for uniqueness

Table 'leave_policies' has year, increment and total_entitled fields. I have written 'validates_uniqueness_of :year' in LeavePolicy model. update_attributes not working even I am not updating year field. Please guide for mistake or suggest any…
2
votes
1 answer

Passing Params to a 301 redirect in rails 2.3

I'm stuck on a Rails 2.3 app trying to redirect some old URLs. I'm new to RoR and know 3+ way better, so I'm having trouble getting this done. So: http://siteurl.com/foo/:foo_id goes to http://siteurl.com/foo/:foo_id/foo_items I think I'm close…
jahrichie
  • 1,215
  • 3
  • 17
  • 26
2
votes
3 answers

Rails 2.3 dynamic has_many conditions based on other association

I have an ActiveRecord model called Books which has a has_one association on authors and a has_many association on publishers. So the following code is all good books.publishers Now I have another AR model, digital_publishers which is similar but…
jackbot
  • 2,931
  • 3
  • 27
  • 35
2
votes
1 answer

Have subfolder show index.html - Rails / nginx

I have a subdirectory on my rails app that I want entirely static. My problem is that I am unable to visit /subdirectory/ and have it show index.html, I have to go to /subdirectory/index.html. How can show the index files for subdirectories? I'm…
wejrowski
  • 439
  • 5
  • 20
2
votes
3 answers

Setting more than one cookie in integration test causes NoMethodError after upgrading rails 2.3

This all worked fine in rails 2.3.5, but when a contractor firm upgraded directly to 2.3.14 suddenly all the integration tests were saying: NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of…
L0ne
  • 470
  • 3
  • 10