ruby-on-rails

Active Record: ordering finds and also returning nulls

I want to find a ordered list of runners by their results. models class Race < ActiveRecord::Base has_many :runners, :dependent => :destroy end class Runner < ActiveRecord::Base belongs_to :race has_one :result, :dependent => :destroy end class Result < ActiveRecord::Base belongs_to :runner end trying to use something like t...

Rails ActionController::MethodNotAllowed causes WSOD in production

I've got a RESTful resource (let's say posts) that excludes the index action. When I go to /posts, ActionController::MethodNotAllowed is raised because GET requests at that URL have been excluded. That much makes sense. The problem is that in the production environment, that URL just generates a white screen in the browser. I can see Ac...

url encode equivalent in ruby on rails

Is there an equivalent to PHP's urlencode in Ruby on Rails 2.3.5? I googled it but all the answers seem to date back to before 2006 and seems dates. This is what I found. It seems a bit abnormal to call CGI::escape in a view. Is there an equivalent helper function? Thanks! ...

Is there a Passenger compatible implementation of taps for Ruby on Rails?

Does anybody know of a gem that provides taps-like functionality, that is compatible with Passenger (mod_rails)? When I try to use taps on a Ruby EE/Passenger setup, I receive the error: `detect_rack_handler': Server handler (thin,mongrel,webrick) not found. (RuntimeError) Although it's not specifically stated in the readme, I am ass...

Is it possible to put validations in controllers in Ruby on Rails?

I have an additional member method (and a corresponding route) called download, for which I'd like to validate the existence of a password field. Putting :validates_presence_of :password in my download method, I get an error claiming it's an undefined method. Is this possible? ...

ruby-on-rails: link-to using post method but parameters are in the url

I'm using link_to 'My link', path(:arg1 => session[:arg1], :arg2 => session[:arg2],:arg3 => anyobject.id), :method => :post but the html link being generate includes (arg1,arg2,arg3) as url query parameters. How can remove them? Did I miss something in the docs? Thanks ...

allow_destroy in a form_for helper - Ruby on Rails

Can I use the 'magic' _destroy attribute that works for accepts_nested_attributes_for for a regular form_for helper? I have a file that I'm uploading via Paperclip and I'd like to have the option to delete it. ...

Why doesn't validation in a model referenced by a callback cause my original transaction to fail?

I have a model with an after_create callback. This callback causes a new record to be created in another model. However if a validation fails in the child record creation, the original transaction is still being saved. This doesn't seem right. According to Rails docs the whole thing is wrapped in a transaction. Am I doing something wron...

long running process behind .NET service

I would like advice from the architecturally minded on the best framework or method for the following: server: a windows service in .NET client: any mainstream language, a combination of .NET app/web app, and also some clients that are Ruby on Linux. One idea I had was to have the Windows Service expose itself as a Web Service, and su...

Stored procedure, activerecord, and alternatives?

In a PowerBuilder-based project, there are overs three hundred stored procedures on a Microsoft SQL Server. It's a client-server application which relies a lot on PB's DataWindow. Now, there is an feature request from the users which will most likely add several web-based screens to interface with the system. We are evaluating Rails (f...

How to pass values between controller methods.

Is there any way to share an array between controller methods and store it until page reloads or calling method of another controller? Some methods should change the array. ...

upgrade Ruby 1.8.6 to Ruby 1.8.7 patch -level 72

Hi When i try to run application server like ruby script/server It says /usr/lib/ruby/1.8/openssl/cipher.rb:22: Cipher is not a module (TypeError). So followed the steps given in the following link : http://iamclovin.posterous.com/how-to-solve-the-cipher-is-not-a-module-error When i run the following command ruby extconf.rb ,...

How out of date is the "blog tutorial" video on the ruby on rails website?

Hay, with the release of Ruby on Rails 3 soon, I thought I'd dive back into a bit of Ruby on Rails programming. I missed out version 2 of rails and had only previously been using 1.2 So i hopped on the video tutorial and worked through it. I just wanted to know how out of date is the video? Does all the theory in that video, and ways of...

Setting up teamcity to run rails specs

Hi everyone, I'm trying to set up teamcity 5.0.2 to run my rails projects specs (just rake spec) My setup is: local git repo rails app root in side it (git_root/site_root) my rake runner settings are: path to rakefile: site_root/Rakefile working directory: site_root rake tasks: spec attached reporters: rspec everything else is ...

Calculate thumbnail sizes with RMagick

I'm using attachment_fu and RMagick to upload/resize images on a rails app. Currently I use the local file system as the storage but I have a plan to use AWS S3 for the job. Anyway I am quite interested to know what other peoples' experiences on using S3 and also I have a one big question for you. In my app when a user uploads an image I...

Ruby on Rails forms: missing template on submit

My controller has two methods: index and search. def index: renders the default view, index.html.erb, and displays a default map using YM4R/GM. def search: renders the default view using render index, but uses form input to display a custom map using YM4R/GM. The view, index.html.erb, contains a partial view, _form.html.erb, and the @...

SimpleDB to ActiveResource. Rails

Im looking for a way to map an ActiveResource to SimpleDB I want to avoid plugins/gems as all I have used are outdated/buggy/not mantained It doesnt seem hard, I wonder if any of you have succesfully implemented a rails app with simpleDB as an Active Resource. How did you do it? Thanks. ...

Rails Prawnto PDFs fail to download in Internet Explorer

Hi there, I have a working Prawnto implementation, except for in IE versions 6 - 8. Here's my print method: prawnto :inline => false, :filename => @purchase.deal.name + "-" + @purchase.customer.name+".pdf", :prawn => {:skip_page_creation=>true} This works fine on Safari, FF and Chrome. You know, the sane browsers. But on IE, the brow...

Adding a blog feature to existing Rails app

I'm looking for some db design help. I have an existing application that I'd like to add the following features to: Support the concept of a Site Blog Allow members to each have their own blog Admins can post to the Site Blog, Members can post to their own member blog Since a Site can only have one blog, and each member can only h...

Event Calendar ROR plugin

Hi all, I am working in ROR framework. I have a requirement to send invitation to a meeting event to the specific users.The event creation should be like in google calendar,hotmail calendar. I need to send invitation through Email, selecting from the users list and i need to fetch their reply (whether they accept or reject the invia...