ruby-on-rails

Why do some page requests hang when fetching Javascript/image assets using Safari and Apache 2.2.3?

Some of the users of our Ruby on Rails app have complained that page requests occasionally hang indefinitely under Safari (a couple have noticed it under Firefox, but it's overwhelmingly Safari users). After some investigation it seems that these requests are being served correctly by our Rails application and the hang occurs when fetch...

Using will_paginate with multiple models (Rails)

Pretty sure that I'm missing something really simple here: I'm trying to display a series of pages that contain instances of two different models - Profiles and Groups. I need them ordering by their name attribute. I could select all of the instances for each model, then sort and paginate them, but this feels sloppy and inefficient. I'...

restful_authentication nothing appears

I have followed the basic instalation ( http://railscasts.com/episodes/67-restful-authentication ) Doing this: 1.) ruby script/generate authenticated user sessions 2.) ruby script/generate authenticated user sessions and rake db:migrate 3.) On the file application_controler.rb I have included include AuthenticatedSystem 4.) On t...

Why does rolling up javascript or css in rails screw with the layout?

On a few occasions now when I've moved from development to staging, I've been bitten by how JavaScript and stylesheets change their behaviour when rolled up into a single file. For example, I'm trying to keep the series of stylesheets modular and small for maintainability, like so: <%= stylesheet_link_tag "reset-fonts-grid.css", "typ...

Displaying a Javascript confirmation dialog in Rails using server-side validation logic

I have a standard form in my Rails app. In certain situations I'd like to display a Javascript confirmation dialog when the Submit button is clicked. The catch is that I need to determine whether or not to display this confirmation on the server side as opposed to doing this in Javascript before the request is submitted to the server. ...

Defining custom exception in a module in Rails

Hi! I've created a custom module (which currently only defines a new Exception class), and put it under lib/lib_th.rb module LibTH module Error IDNotFound = Class.new end end I should not need to require/include the module in my code, as it should be automatically loaded, since it follows the conventional naming rules...

rails application passenger possible errors

I have installed splunk to retrieve information from my log files and elert me when specific keyword is found. Is there any way to get possible rails errors so that I can put those as keywords?? ...

Thinking Sphinx Search Box

I'm trying to get Thinking Sphinx running on my site but I'm not sure how to set up the search box and button for the index page. I have in my model: define_index do indexes :name indexes description where "approved = 'true'" end In my controller: def index @businesses = Business.search params[:search] end And in my in...

Java/Groovy Rails Database Migrations

Is there a tool in the Java/Groovy world that lets me manage database changes similar to the way that Rails Database Migrations work? ...

Is there a rails plugin to do effective dating

Something like act_as_taggable or act_as_versioned but for SAP style effective dating? Sorry for the lack of details. Here is some more: The plugin would add a start_date and end_date to a model. Basic operation should always be on entity valid for today or a parameter date Update should make a copy of the effective entity with a sta...

Comprehensive graphing and charting solutions...?

Hi All, I have need to produce LINE, BAR, and PIE charts in Rails. I have found several that do all these. However the one caveat is that I can never find a solution that does all as well as XY-SCATTER. I've looked at Gruff,Scruffy,Gnuplot, etc. and none of them do "everything". Can anyone recommend a local (i.e. doesn't require net...

(Rails) Creating multi-dimensional hashes/arrays from a data set...?

Hi All, I'm having a bit of an issue wrapping my head around something. I'm currently using a hacked version of Gruff in order to accommodate "Scatter Plots". That said, the data is entered in the form of: g.data("Person1",[12,32,34,55,23],[323,43,23,43,22]) ...where the first item is the ENTITY, the second item is X-COORDs, and t...

Is pure client-side dom manipulation possible using Rails' prototype helper?

I have a div that I want to show or hide depending on whether a hyperlink is clicked. This obviously doesn't require any server-side interaction. But is there a way to do this using Rails' prototype helpers? Or should I simply use JQuery or pure Javascript to do this type of client-side manipulation? ...

How to estimate Rails app development cost?

I have an application I would like built. For the most part, I know what I want. And, I have good sketches of how it should work and look. I would like to understand how to estimate the cost to implement an application. I would like to do this prior to approaching developers so that I can make sure I can afford to fund the development m...

Rails: Routing resources/paths with :path_prefix and :name_prefix

I have the following route definied: map.resources :addresses, :path_prefix => ':site', :name_prefix => 's_' I've had no problem correcting my scaffolding links for "Show" and "New". But I am getting a failure to generate error when attempting to use: edit_s_address_path(address) or edit_s_address rake routes shows that this is the...

How do I get aside layout to work in hobo 0.8

I have tried several different things in clean.dryml and application.dryml. It's not clear (without reading the source) how this works. I would expect one of these to work, but they do not. <old-page merge layout="aside"> OR <old-page merge aside-layout> ...

How can I disable URL-encoding of cookies in Rails

I have a Rails application that has to co-exist with a very old legacy application. The legacy application looks for a cookie that has a value containing a specific string of characters. Unfortunately, the characters in the legacy cookie often contain slashes. The problem I have is that when the Rails application writes the cookie it ...

Why does calling create as a class method not save the record?

Suppose a simple ActiveRecord model corresponding to a table with just two columns, id and name: class Model < ActiveRecord::Base def self.my_create(name) create(:name => name) end end If I call Model.my_create, a record is created and saved: >> Model.my_create('foo') => #<Model id: 1, name: "foo"> But If I call Model.creat...

Is it OK to use Ruby 1.8.5?

I'm setting up a new RedHat Enterprise Linux 5 system to host Ruby apps running under Apache with Phusion Passenger. I've updated all the local packages on the system. Here is what RedHat is giving me for Ruby: $ ruby -v ruby 1.8.5 (2006-08-25) [i386-linux] That's pretty old. Is it better to use what RedHat provides or install a newer...

Rails version changes regarding tutorials?

I've been going through some good (seeming) resources for Rails tutorials, and will dutifully follow the steps until halfway through I realize a helper has been dropped or something else has changed. Aside from the 1.0->2.0 change (which I imagine was significant, given typical versioning), are there other updates that have fundamentally...