# Rails

**URL:** https://www.ruby-forum.com/c/ruby-on-rails/6.md?page=932

[Latest](https://www.ruby-forum.com/latest.md) · [Categories](https://www.ruby-forum.com/categories.md) · [Tags](https://www.ruby-forum.com/tags.md)

**Page:** 933

---

## [Rails SequencedHash source file](https://www.ruby-forum.com/t/rails-sequencedhash-source-file/167473)

<div class="topic-metadata">

**Author:** [@epink](https://www.ruby-forum.com/u/epink)\
**Replies:** 2\
**Last updated:** [May 8, 2009, 8:55am UTC](https://www.ruby-forum.com/t/rails-sequencedhash-source-file/167473 "2009-05-08T08:55:07Z")

</div>

I am testing AlumniOnRails (http://rubyforge.org/frs/?group\_id=2959&release\_id=17170) which is based on Rails 1.2.6 (I know it’s outdated) and managed to get it up, installed the required gems, created and migrated th…

---

## [Removing part of a String](https://www.ruby-forum.com/t/removing-part-of-a-string/167461)

<div class="topic-metadata">

**Author:** [@JannaB](https://www.ruby-forum.com/u/JannaB)\
**Replies:** 4\
**Last updated:** [May 8, 2009, 8:00am UTC](https://www.ruby-forum.com/t/removing-part-of-a-string/167461 "2009-05-08T08:00:50Z")

</div>

I want to get the names of all files in a given directory. When I employ the Dir\[\] method, it returns the name of the files with the pathname I invoked it with: allfiles = Dir\["public/images/icons/\*\*"\] So to remedy…

---

## [Rails 3 code](https://www.ruby-forum.com/t/rails-3-code/167471)

<div class="topic-metadata">

**Author:** [@rahil](https://www.ruby-forum.com/u/rahil)\
**Replies:** 1\
**Last updated:** [May 8, 2009, 5:47am UTC](https://www.ruby-forum.com/t/rails-3-code/167471 "2009-05-08T05:47:40Z")

</div>

I would like to see few examples in Rails 3 and would like to see few Rails 3 code. I know, few samples were shown at Rails conference. Can any one point me few of them. Thanks

---

## [Observers or callbacks?](https://www.ruby-forum.com/t/observers-or-callbacks/163499)

<div class="topic-metadata">

**Author:** [@tekwiz](https://www.ruby-forum.com/u/tekwiz)\
**Replies:** 3\
**Last updated:** [May 8, 2009, 3:51am UTC](https://www.ruby-forum.com/t/observers-or-callbacks/163499 "2009-05-08T03:51:19Z")

</div>

Why use an Observer for a single model rather than using a callback in the ActiveRecord object? They seem like they work identically. Is there a difference I’m missing? For example, these seem like they would do the…

---

## [Receiver for \*\_path or \*\_url](https://www.ruby-forum.com/t/receiver-for-path-or-url/167462)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 1\
**Last updated:** [May 8, 2009, 12:19am UTC](https://www.ruby-forum.com/t/receiver-for-path-or-url/167462 "2009-05-08T00:19:56Z")

</div>

I’m trying to find out the receiver for \*\_path messages as in: link\_to ‘Show’, product\_path(@product) This came up when I moved the creation of view fragments into objects (RColumn) intended to encapsulate the view be…

---

## [Sum - wrong number of arguments?](https://www.ruby-forum.com/t/sum-wrong-number-of-arguments/167356)

<div class="topic-metadata">

**Author:** [@milandobrota](https://www.ruby-forum.com/u/milandobrota)\
**Replies:** 6\
**Last updated:** [May 8, 2009, 12:09am UTC](https://www.ruby-forum.com/t/sum-wrong-number-of-arguments/167356 "2009-05-08T00:09:52Z")

</div>

I got the following error after I ran script/server: /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action\_controller/layout.rb:184:in sum': wrong number of arguments (1 for 0) (ArgumentError) from /usr/lib/ruby/gems…

---

## [HABTM pregunta](https://www.ruby-forum.com/t/habtm-pregunta/167463)

<div class="topic-metadata">

**Author:** [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Replies:** 0\
**Last updated:** [May 8, 2009, 12:08am UTC](https://www.ruby-forum.com/t/habtm-pregunta/167463 "2009-05-08T00:08:14Z")

</div>

I have 2 habtm relations: FORM \<- HABTM-\> COMPANIES FORM \<- HABTM -\> SITES Is there an easy way to do a query like: Find out what sites belong to what company related to the form? Also is there a better or more effi…

---

## [Rails plain ajax](https://www.ruby-forum.com/t/rails-plain-ajax/167355)

<div class="topic-metadata">

**Author:** [@builtbysimple](https://www.ruby-forum.com/u/builtbysimple)\
**Replies:** 2\
**Last updated:** [May 8, 2009, 12:04am UTC](https://www.ruby-forum.com/t/rails-plain-ajax/167355 "2009-05-08T00:04:08Z")

</div>

Dear all, Does anybody know a good reference for sending ajax request to rails without using the rails ajax helper? I want to use other framework, namely jQuery. Because without using the ajax helper from rails I en…

---

## [Hide attribute from scaffolding](https://www.ruby-forum.com/t/hide-attribute-from-scaffolding/167458)

<div class="topic-metadata">

**Author:** [@p-b](https://www.ruby-forum.com/u/p-b)\
**Replies:** 2\
**Last updated:** [May 7, 2009, 11:46pm UTC](https://www.ruby-forum.com/t/hide-attribute-from-scaffolding/167458 "2009-05-07T23:46:29Z")

</div>

Hey, I have a simple model having some attributes. One of those attributes is an overall grade, which I don’t want users to be able to edit it on their own. I display all the info in the database using a scaffold. Ho…

---

## [Setting Up Setters](https://www.ruby-forum.com/t/setting-up-setters/167459)

<div class="topic-metadata">

**Author:** [@rapdup](https://www.ruby-forum.com/u/rapdup)\
**Replies:** 1\
**Last updated:** [May 7, 2009, 11:04pm UTC](https://www.ruby-forum.com/t/setting-up-setters/167459 "2009-05-07T23:04:25Z")

</div>

If I have a setter method that needs to manipulate the incoming value before setting itself, how can I do this without it be self referencing? In the example below, I’ve defined “start\_date=”, so how do I now save a v…

---

## [Outputting strict JSON](https://www.ruby-forum.com/t/outputting-strict-json/167449)

<div class="topic-metadata">

**Author:** [@lyntaff](https://www.ruby-forum.com/u/lyntaff)\
**Replies:** 2\
**Last updated:** [May 7, 2009, 10:13pm UTC](https://www.ruby-forum.com/t/outputting-strict-json/167449 "2009-05-07T22:13:18Z")

</div>

Does any body know how I can output JSON so that instead of getting: {booking: {id: 1, name: “foo”} You get this instead: {id: 1, name: “foo”} Can’t find a solution for this at all Thank you for any help.

---

## [Passing hard-coded values to controller](https://www.ruby-forum.com/t/passing-hard-coded-values-to-controller/167274)

<div class="topic-metadata">

**Author:** [@cbnewman](https://www.ruby-forum.com/u/cbnewman)\
**Replies:** 8\
**Last updated:** [May 7, 2009, 10:08pm UTC](https://www.ruby-forum.com/t/passing-hard-coded-values-to-controller/167274 "2009-05-07T22:08:36Z")

</div>

given the following code snippet: class PatientsController \< ApplicationController … def find @patients = Patient.find(:all, :conditions =\> { :location =\> \[params:search\_string\] }) end I would like to add a few ha…

---

## [Named\_scope issue undefined method that is a db column name](https://www.ruby-forum.com/t/named-scope-issue-undefined-method-that-is-a-db-column-name/167431)

<div class="topic-metadata">

**Author:** [@erik](https://www.ruby-forum.com/u/erik)\
**Replies:** 3\
**Last updated:** [May 7, 2009, 9:17pm UTC](https://www.ruby-forum.com/t/named-scope-issue-undefined-method-that-is-a-db-column-name/167431 "2009-05-07T21:17:56Z")

</div>

I’m new to named\_scope so bear with me if this is dumb. I have created two named scopes both using lambda to pass in arguments. One passes in a single argument and works great the other passes in two arguments and do…

---

## [Setting Session Variables in Integration Tests](https://www.ruby-forum.com/t/setting-session-variables-in-integration-tests/167443)

<div class="topic-metadata">

**Author:** [@pinkman](https://www.ruby-forum.com/u/pinkman)\
**Replies:** 2\
**Last updated:** [May 7, 2009, 9:15pm UTC](https://www.ruby-forum.com/t/setting-session-variables-in-integration-tests/167443 "2009-05-07T21:15:32Z")

</div>

All I want to do is set a session variable when I make a request. Here’s my code: class ProjectIntegrationTest \< ActionController::IntegrationTest def test\_truth user = user\_for\_test user.access\_project\_index\_page …

---

## [Controller redirect\_to to leave iframe](https://www.ruby-forum.com/t/controller-redirect-to-to-leave-iframe/167442)

<div class="topic-metadata">

**Author:** [@nextpulse](https://www.ruby-forum.com/u/nextpulse)\
**Replies:** 5\
**Last updated:** [May 7, 2009, 8:52pm UTC](https://www.ruby-forum.com/t/controller-redirect-to-to-leave-iframe/167442 "2009-05-07T20:52:37Z")

</div>

Inside an iframe, I want the controller to redirect\_to to the parent (i.e. target =’\_parent’). Any ideas? (Everything I’ve tried- via redirect\_to - just keeps it inside the iframe)

---

## [Has\_many through association](https://www.ruby-forum.com/t/has-many-through-association/167417)

<div class="topic-metadata">

**Author:** [@intern\_ruby](https://www.ruby-forum.com/u/intern_ruby)\
**Replies:** 3\
**Last updated:** [May 7, 2009, 7:32pm UTC](https://www.ruby-forum.com/t/has-many-through-association/167417 "2009-05-07T19:32:02Z")

</div>

1))))) class Group \< ActiveRecord::Base has\_many :group\_users has\_many :users, :through =\> :group\_users end 2)))))))))class User \< ActiveRecord::Base has\_many :group\_users has\_many :groups, :through =\> :group\_users …

---

## [How to lock and unlock table in ruby on rails?](https://www.ruby-forum.com/t/how-to-lock-and-unlock-table-in-ruby-on-rails/167276)

<div class="topic-metadata">

**Author:** [@venkat\_ruby](https://www.ruby-forum.com/u/venkat_ruby)\
**Replies:** 6\
**Last updated:** [May 7, 2009, 7:19pm UTC](https://www.ruby-forum.com/t/how-to-lock-and-unlock-table-in-ruby-on-rails/167276 "2009-05-07T19:19:21Z")

</div>

Hello all, I written the below code in common controller. I will pass the model\_name and it has to lock and unlock the table. Please help me to correct this code… def lock\_table(model\_name) locked\_table = model\_name…

---

## [Relations between contact\_person and contact\_business](https://www.ruby-forum.com/t/relations-between-contact-person-and-contact-business/167435)

<div class="topic-metadata">

**Author:** [@togo123](https://www.ruby-forum.com/u/togo123)\
**Replies:** 0\
**Last updated:** [May 7, 2009, 7:11pm UTC](https://www.ruby-forum.com/t/relations-between-contact-person-and-contact-business/167435 "2009-05-07T19:11:02Z")

</div>

Hello all, i am stuck with something. i have the following situation: contacts---| |--|0-1|--contact\_businesses | (either one of booth; business or contact) |--|0-1|--contact\_p…

---

## [Sending email problem](https://www.ruby-forum.com/t/sending-email-problem/167429)

<div class="topic-metadata">

**Author:** [@kentor](https://www.ruby-forum.com/u/kentor)\
**Replies:** 1\
**Last updated:** [May 7, 2009, 6:41pm UTC](https://www.ruby-forum.com/t/sending-email-problem/167429 "2009-05-07T18:41:49Z")

</div>

Hello, I’m very new to ruby on rails. I’m trying to setup a simple form to send an email. I’ve followed many different tutorials and nothing seems to work for me… I’ve tried using tls, pony plugin, actionmailer, etc……

---

## [DRb::DRbConnError](https://www.ruby-forum.com/t/drb-drbconnerror/167423)

<div class="topic-metadata">

**Author:** [@mindtonic](https://www.ruby-forum.com/u/mindtonic)\
**Replies:** 2\
**Last updated:** [May 7, 2009, 6:38pm UTC](https://www.ruby-forum.com/t/drb-drbconnerror/167423 "2009-05-07T18:38:52Z")

</div>

Hello, I am trying to run my tests using rake, but I keep getting this error. Anyone know why that might be happening?

---

## [About rails version](https://www.ruby-forum.com/t/about-rails-version/167427)

<div class="topic-metadata">

**Author:** [@yuwtnb](https://www.ruby-forum.com/u/yuwtnb)\
**Replies:** 0\
**Last updated:** [May 7, 2009, 6:33pm UTC](https://www.ruby-forum.com/t/about-rails-version/167427 "2009-05-07T18:33:01Z")

</div>

Hello all. I’m planning to use the ruby 1.8.5. And I was wondering which version of rails should I use. In the official web site it seems that rails still supports v 1.8.5 We recommend Ruby 1.8.7 for use with Rails. …

---

## [Rails routes with prefix before the :id](https://www.ruby-forum.com/t/rails-routes-with-prefix-before-the-id/167428)

<div class="topic-metadata">

**Author:** [@Sharcho](https://www.ruby-forum.com/u/Sharcho)\
**Replies:** 0\
**Last updated:** [May 7, 2009, 6:33pm UTC](https://www.ruby-forum.com/t/rails-routes-with-prefix-before-the-id/167428 "2009-05-07T18:33:01Z")

</div>

This works: map.connect ‘/bananas/pdf/file/:id.pdf’, :controller =\> ‘bananas’, :action =\> ‘pdf’ This doesn’t work: map.connect ‘/bananas/pdf/file\_:id.pdf’, :controller =\> ‘bananas’, :action =\> ‘pdf’ So once I chang…

---

## [How to apply spreadsheet-excel-ole-storage.patch and parseexcel-ole-storage.patch](https://www.ruby-forum.com/t/how-to-apply-spreadsheet-excel-ole-storage-patch-and-parseexcel-ole-storage-patch/167421)

<div class="topic-metadata">

**Author:** [@deeparaj](https://www.ruby-forum.com/u/deeparaj)\
**Replies:** 0\
**Last updated:** [May 7, 2009, 6:05pm UTC](https://www.ruby-forum.com/t/how-to-apply-spreadsheet-excel-ole-storage-patch-and-parseexcel-ole-storage-patch/167421 "2009-05-07T18:05:27Z")

</div>

I am going to export data to excel file from my project. I am using spreadsheet-excel (0.3.5.1) gem to read/write data in excel. I got #\<MaxSizeError: MaxSizeError\> error when exporting some amount of data to excel. …

---

## [Google maps error with Rails 2.3.2](https://www.ruby-forum.com/t/google-maps-error-with-rails-2-3-2/164161)

<div class="topic-metadata">

**Author:** [@tkbeili](https://www.ruby-forum.com/u/tkbeili)\
**Replies:** 2\
**Last updated:** [May 7, 2009, 6:05pm UTC](https://www.ruby-forum.com/t/google-maps-error-with-rails-2-3-2/164161 "2009-05-07T18:05:27Z")

</div>

I have been using Google Maps with Rails 2.0.2 and 2.1.0 which works fine. I followed this tutorial: Now after upgrading to Rails 2.3.2 I’m getting the following error: uninitialized constant ActionController::Abstrac…

---

## [Micro-frameworks](https://www.ruby-forum.com/t/micro-frameworks/167420)

<div class="topic-metadata">

**Author:** [@msojka](https://www.ruby-forum.com/u/msojka)\
**Replies:** 0\
**Last updated:** [May 7, 2009, 6:02pm UTC](https://www.ruby-forum.com/t/micro-frameworks/167420 "2009-05-07T18:02:31Z")

</div>

I’ve written an article on micro-frameworks, featuring Sinatra for Ruby and Limonade for PHP. You can read the story online at http://www.linux-mag.com/id/7324 . I also wrote an intro to the Ruby debugger and how to …

---

## [Database - Switching Tables](https://www.ruby-forum.com/t/database-switching-tables/167164)

<div class="topic-metadata">

**Author:** [@djames](https://www.ruby-forum.com/u/djames)\
**Replies:** 12\
**Last updated:** [May 7, 2009, 6:01pm UTC](https://www.ruby-forum.com/t/database-switching-tables/167164 "2009-05-07T18:01:20Z")

</div>

I have a mailing-list database that consists of several tables (e.g., clients table, prospects table, etc.). How can I switch between these tables within my mailing-list Rails application? I have a feeling that if I …

---

## [Open call works fine in irb but not through webrick server](https://www.ruby-forum.com/t/open-call-works-fine-in-irb-but-not-through-webrick-server/167336)

<div class="topic-metadata">

**Author:** [@Karika](https://www.ruby-forum.com/u/Karika)\
**Replies:** 2\
**Last updated:** [May 7, 2009, 5:57pm UTC](https://www.ruby-forum.com/t/open-call-works-fine-in-irb-but-not-through-webrick-server/167336 "2009-05-07T17:57:49Z")

</div>

require ‘rss/1.0’ require ‘rss/2.0’ require ‘open-uri’ source = “something.com” # url or local file content = “” # raw content of url will be loaded here open(source,:proxy =\> nil) do |s| content = s.read end rss =…

---

## [Dabs like product filtering](https://www.ruby-forum.com/t/dabs-like-product-filtering/167415)

<div class="topic-metadata">

**Author:** [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Replies:** 0\
**Last updated:** [May 7, 2009, 5:22pm UTC](https://www.ruby-forum.com/t/dabs-like-product-filtering/167415 "2009-05-07T17:22:57Z")

</div>

Hi, Im trying to create a search\\filtering similar to dabs, see link below. So the “Refine Your Search” menu breaks down the different categories\\sub categories for a product with a count of how many are available an…

---

## [Template : modify file to add code](https://www.ruby-forum.com/t/template-modify-file-to-add-code/167413)

<div class="topic-metadata">

**Author:** [@babiben](https://www.ruby-forum.com/u/babiben)\
**Replies:** 0\
**Last updated:** [May 7, 2009, 5:14pm UTC](https://www.ruby-forum.com/t/template-modify-file-to-add-code/167413 "2009-05-07T17:14:22Z")

</div>

Hello, When using rails templates (http://github.com/jeremymcanally/rails-templates/tree/master), is it possible to complete a file and to add code in this file ? For example, i create a model “home” and i would like…

---

## [Paperclip: strange mime type on windows](https://www.ruby-forum.com/t/paperclip-strange-mime-type-on-windows/167409)

<div class="topic-metadata">

**Author:** [@triplem](https://www.ruby-forum.com/u/triplem)\
**Replies:** 1\
**Last updated:** [May 7, 2009, 4:46pm UTC](https://www.ruby-forum.com/t/paperclip-strange-mime-type-on-windows/167409 "2009-05-07T16:46:20Z")

</div>

When i upload a pdf, validations doesn’t work, only images validation works. Avoiding check, file was loaded but with this content type: file\_content\_type: “binary/octet-stream” How can i solve? I’d like to have “appl…

[Previous page](https://www.ruby-forum.com/c/ruby-on-rails/6.md?page=931)

[Next page](https://www.ruby-forum.com/c/ruby-on-rails/6.md?page=933)
