# Rails

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

[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:** 1209

---

## [Comparing between different attributes. programming noobie](https://www.ruby-forum.com/t/comparing-between-different-attributes-programming-noobie/146375)

<div class="topic-metadata">

**Author:** [@tyliong](https://www.ruby-forum.com/u/tyliong)\
**Replies:** 15\
**Last updated:** [September 1, 2008, 11:55am UTC](https://www.ruby-forum.com/t/comparing-between-different-attributes-programming-noobie/146375 "2008-09-01T11:55:37Z")

</div>

Hi currently i am have a app that checks the cheapest price between colums/attributes if model.attribute1 \< model.attribute 2 result = model.attribute 1 else if model … result = model. att2 else if model att3 \< i…

---

## [Generating Images/PDF Server-Side](https://www.ruby-forum.com/t/generating-images-pdf-server-side/147387)

<div class="topic-metadata">

**Author:** [@mdaoust](https://www.ruby-forum.com/u/mdaoust)\
**Replies:** 4\
**Last updated:** [September 1, 2008, 11:03am UTC](https://www.ruby-forum.com/t/generating-images-pdf-server-side/147387 "2008-09-01T11:03:55Z")

</div>

Hi, I am working on a project where I need to generate a chart (a bit like a pie chart, but very customised) and insert this into a PDF document. Does anybody have any advice on ruby libraries (or other techniques) fo…

---

## [Upadte database](https://www.ruby-forum.com/t/upadte-database/147384)

<div class="topic-metadata">

**Author:** [@gourab](https://www.ruby-forum.com/u/gourab)\
**Replies:** 1\
**Last updated:** [September 1, 2008, 10:49am UTC](https://www.ruby-forum.com/t/upadte-database/147384 "2008-09-01T10:49:48Z")

</div>

i want to update database .

---

## [Action view mutiplication problem and why doesn't method work](https://www.ruby-forum.com/t/action-view-mutiplication-problem-and-why-doesnt-method-work/147379)

<div class="topic-metadata">

**Author:** [@tyliong](https://www.ruby-forum.com/u/tyliong)\
**Replies:** 3\
**Last updated:** [September 1, 2008, 10:18am UTC](https://www.ruby-forum.com/t/action-view-mutiplication-problem-and-why-doesnt-method-work/147379 "2008-09-01T10:18:04Z")

</div>

Arggh sorry abouht the above post i accidently sent it without finihing it. my second question is that i have put this method in the controller def qx(product,price) result = product.price \* product.quantity end an…

---

## [Mixing JS with check\_box\_tag](https://www.ruby-forum.com/t/mixing-js-with-check-box-tag/147371)

<div class="topic-metadata">

**Author:** [@splashlin](https://www.ruby-forum.com/u/splashlin)\
**Replies:** 1\
**Last updated:** [September 1, 2008, 10:16am UTC](https://www.ruby-forum.com/t/mixing-js-with-check-box-tag/147371 "2008-09-01T10:16:54Z")

</div>

I have a check\_box\_tag in my code that the user clicks to add more information. When the checkbox is checked or unchecked I want to call a JS function I have written called toggleBox(). Does anyone know how to do th…

---

## [Mail sending in production mode](https://www.ruby-forum.com/t/mail-sending-in-production-mode/147375)

<div class="topic-metadata">

**Author:** [@sijo](https://www.ruby-forum.com/u/sijo)\
**Replies:** 1\
**Last updated:** [September 1, 2008, 10:12am UTC](https://www.ruby-forum.com/t/mail-sending-in-production-mode/147375 "2008-09-01T10:12:48Z")

</div>

Hi As of now I had been running my server in development mode. And for mail sending in confif/environments/development.rb I have configured the mailsending method,port etc and they are working properly .Now I would l…

---

## [Action view mutiplication problem and why doesn't method work](https://www.ruby-forum.com/t/action-view-mutiplication-problem-and-why-doesnt-method-work/147378)

<div class="topic-metadata">

**Author:** [@tyliong](https://www.ruby-forum.com/u/tyliong)\
**Replies:** 0\
**Last updated:** [September 1, 2008, 9:46am UTC](https://www.ruby-forum.com/t/action-view-mutiplication-problem-and-why-doesnt-method-work/147378 "2008-09-01T09:46:25Z")

</div>

I am trying to multiply something in view but what i get is the first parameter without the 2nd parameter being multiplied. \<%= product.price\*product.quantity %\> only gives product.price Secondly I have put this metho…

---

## [Array::index broken](https://www.ruby-forum.com/t/array-index-broken/147372)

<div class="topic-metadata">

**Author:** [@Glen](https://www.ruby-forum.com/u/Glen)\
**Replies:** 3\
**Last updated:** [September 1, 2008, 6:39am UTC](https://www.ruby-forum.com/t/array-index-broken/147372 "2008-09-01T06:39:42Z")

</div>

Is there a way to call Array::index in Rails??? This is what I want to do: @photos.map do |value| @photos.index(value)%5 == 0 ? (@sorted\_photos\[i += 1\] ||= \[\]) \<\< value : (@sorted\_photos\[i\] ||= \[\]) \<\< value end How…

---

## [Attachment\_fu show unsaved images?](https://www.ruby-forum.com/t/attachment-fu-show-unsaved-images/147353)

<div class="topic-metadata">

**Author:** [@andrewdon](https://www.ruby-forum.com/u/andrewdon)\
**Replies:** 1\
**Last updated:** [September 1, 2008, 4:57am UTC](https://www.ruby-forum.com/t/attachment-fu-show-unsaved-images/147353 "2008-09-01T04:57:09Z")

</div>

Is there any established way to display an image uploaded by attachment\_fu before the model with which it is associated is actually saved? For instance, I have an Artwork model which has many images. I’d like to allo…

---

## [What gets called on belongs\_to child on parent.save](https://www.ruby-forum.com/t/what-gets-called-on-belongs-to-child-on-parent-save/147369)

<div class="topic-metadata">

**Author:** [@sbellware](https://www.ruby-forum.com/u/sbellware)\
**Replies:** 0\
**Last updated:** [September 1, 2008, 4:45am UTC](https://www.ruby-forum.com/t/what-gets-called-on-belongs-to-child-on-parent-save/147369 "2008-09-01T04:45:43Z")

</div>

Hi, I’m trying to write a spec that documents that child.save gets called when parent.save is called. Child has belongs\_to :parent. What is the method that gets called on the child association on parent.save? Can i…

---

## [Multiple vhosts with rails sites with apache+mongrel a better way?](https://www.ruby-forum.com/t/multiple-vhosts-with-rails-sites-with-apache-mongrel-a-better-way/147363)

<div class="topic-metadata">

**Author:** [@ReK2SS](https://www.ruby-forum.com/u/ReK2SS)\
**Replies:** 2\
**Last updated:** [September 1, 2008, 4:11am UTC](https://www.ruby-forum.com/t/multiple-vhosts-with-rails-sites-with-apache-mongrel-a-better-way/147363 "2008-09-01T04:11:14Z")

</div>

Hi as of now I have two sites each using one port 8080 and 8081 under mongrel and apache as the front… works ok but as a good network engineer I have to have tons of ports open, is uggly, before I can even think abou…

---

## [Primary key non default name](https://www.ruby-forum.com/t/primary-key-non-default-name/147312)

<div class="topic-metadata">

**Author:** [@samson78](https://www.ruby-forum.com/u/samson78)\
**Replies:** 12\
**Last updated:** [September 1, 2008, 1:27am UTC](https://www.ruby-forum.com/t/primary-key-non-default-name/147312 "2008-09-01T01:27:32Z")

</div>

Hi, Is there a way when using scaffolding to name a primary key like tablename\_id instead of the default id? Thanks, Kostas

---

## [Installation Help for RoR on Debian Etch](https://www.ruby-forum.com/t/installation-help-for-ror-on-debian-etch/147355)

<div class="topic-metadata">

**Author:** [@maxbohr](https://www.ruby-forum.com/u/maxbohr)\
**Replies:** 3\
**Last updated:** [September 1, 2008, 1:03am UTC](https://www.ruby-forum.com/t/installation-help-for-ror-on-debian-etch/147355 "2008-09-01T01:03:55Z")

</div>

I followed the installation guide on the rubyonrails wiki but rails said gem wasn’t up to date, and then there were issues with rails. So I said screw it and decided to doa fresh install of debian and try over. Every …

---

## [File field becomes String](https://www.ruby-forum.com/t/file-field-becomes-string/147332)

<div class="topic-metadata">

**Author:** [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Replies:** 1\
**Last updated:** [August 31, 2008, 11:52pm UTC](https://www.ruby-forum.com/t/file-field-becomes-string/147332 "2008-08-31T23:52:12Z")

</div>

I have a file\_field that works fine when sending up a file. But when making an update the same field behaves like a String, and consequently the params\[:file\]\[:attachment\].content\_type fails. Why is this?

---

## [Capistrano deploy:stop](https://www.ruby-forum.com/t/capistrano-deploy-stop/147342)

<div class="topic-metadata">

**Author:** [@surge](https://www.ruby-forum.com/u/surge)\
**Replies:** 2\
**Last updated:** [August 31, 2008, 8:37pm UTC](https://www.ruby-forum.com/t/capistrano-deploy-stop/147342 "2008-08-31T20:37:51Z")

</div>

Hello, everybody. After following like 20 sources on how to set up a mongrel cluster, I got most of it working. There are some nagging questions though… In my mongrel\_cluster.yml, I specified the pid name to be mong…

---

## [openLDAP in Ruby on Rails](https://www.ruby-forum.com/t/openldap-in-ruby-on-rails/147327)

<div class="topic-metadata">

**Author:** [@pshussain](https://www.ruby-forum.com/u/pshussain)\
**Replies:** 3\
**Last updated:** [August 31, 2008, 8:34pm UTC](https://www.ruby-forum.com/t/openldap-in-ruby-on-rails/147327 "2008-08-31T20:34:19Z")

</div>

Hai All, I am a professional RoR Developer.Right we are doing project like maintaining the documents.For this project, We would like to openLDAP to store the documents.But I dont have any knowledge in opnLDAP.if anybo…

---

## [Best way to capture metadata](https://www.ruby-forum.com/t/best-way-to-capture-metadata/147349)

<div class="topic-metadata">

**Author:** [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Replies:** 0\
**Last updated:** [August 31, 2008, 8:08pm UTC](https://www.ruby-forum.com/t/best-way-to-capture-metadata/147349 "2008-08-31T20:08:21Z")

</div>

Hi, I am trying to dynamically add metadata to documents. I have a document model, but I want to be able to add other data to it. Basically create more columns based on the data that people need to add. ie invoice nu…

---

## [Best way to generate an API key?](https://www.ruby-forum.com/t/best-way-to-generate-an-api-key/147228)

<div class="topic-metadata">

**Author:** [@marstoni](https://www.ruby-forum.com/u/marstoni)\
**Replies:** 4\
**Last updated:** [August 31, 2008, 8:01pm UTC](https://www.ruby-forum.com/t/best-way-to-generate-an-api-key/147228 "2008-08-31T20:01:31Z")

</div>

I’m in the middle of creating an API for our app and wanted to get some feedback on the best way to generate unique APIKEY’s for each account. Similar to Basecamp’s API keys for example. md5 hash of username:password…

---

## [Find syntax problem noob problem](https://www.ruby-forum.com/t/find-syntax-problem-noob-problem/147290)

<div class="topic-metadata">

**Author:** [@tyliong](https://www.ruby-forum.com/u/tyliong)\
**Replies:** 7\
**Last updated:** [August 31, 2008, 7:31pm UTC](https://www.ruby-forum.com/t/find-syntax-problem-noob-problem/147290 "2008-08-31T19:31:38Z")

</div>

Hi, I need to know why \<%= SglineItem.find(1).sguser\_id %\> works but \<%= SglineItem.find(:all, :conditions =\> “sguser\_id = #{params\[:id\]}”).sguser\_id %\> does not. the second gives sguser\_id is not valid.

---

## [Attr\_accessible & site administrator issue](https://www.ruby-forum.com/t/attr-accessible-site-administrator-issue/147347)

<div class="topic-metadata">

**Author:** [@chunkyslink](https://www.ruby-forum.com/u/chunkyslink)\
**Replies:** 0\
**Last updated:** [August 31, 2008, 7:27pm UTC](https://www.ruby-forum.com/t/attr-accessible-site-administrator-issue/147347 "2008-08-31T19:27:41Z")

</div>

I’m working on an app which has a :featured\_at in Users and Groups tables. The attribute enables a site admin to set records to a :featured\_at datetime. There’s named spaced admin controllers for the Users and Groups.…

---

## [Best Approach for Master/Slave Form SELECTs](https://www.ruby-forum.com/t/best-approach-for-master-slave-form-selects/147345)

<div class="topic-metadata">

**Author:** [@mrpete](https://www.ruby-forum.com/u/mrpete)\
**Replies:** 1\
**Last updated:** [August 31, 2008, 6:43pm UTC](https://www.ruby-forum.com/t/best-approach-for-master-slave-form-selects/147345 "2008-08-31T18:43:38Z")

</div>

I want to have the second select options dependent on the selection of the first select option. Is this built into Rails? I haven’t seen it. I’d rather not right JavaScript and Ajax to pull values in background unle…

---

## [Attachment\_fu && image caching](https://www.ruby-forum.com/t/attachment-fu-image-caching/196797)

<div class="topic-metadata">

**Author:** [@Valery\_K](https://www.ruby-forum.com/u/Valery_K)\
**Replies:** 2\
**Last updated:** [August 31, 2008, 3:56pm UTC](https://www.ruby-forum.com/t/attachment-fu-image-caching/196797 "2008-08-31T15:56:47Z")

</div>

I have a little problem: I’m operating with attachment\_fu object (:storage =\> :file\_system), for instance @image. When I have to render it into the view, i’d like to use native helper \< %= image\_tag(@image.public\_fil…

---

## [Browser detection with Rails?](https://www.ruby-forum.com/t/browser-detection-with-rails/145287)

<div class="topic-metadata">

**Author:** [@chaosbanane](https://www.ruby-forum.com/u/chaosbanane)\
**Replies:** 7\
**Last updated:** [August 31, 2008, 5:40am UTC](https://www.ruby-forum.com/t/browser-detection-with-rails/145287 "2008-08-31T05:40:19Z")

</div>

hi I can’t find any posibility to detect the browser with rails so i tried javascript. The problem is, that the flash message will shown independent of the IF request. Any ideas? Greeting Chaos

---

## [Drop down menu to show directories](https://www.ruby-forum.com/t/drop-down-menu-to-show-directories/147326)

<div class="topic-metadata">

**Author:** [@toro04](https://www.ruby-forum.com/u/toro04)\
**Replies:** 0\
**Last updated:** [August 31, 2008, 5:30am UTC](https://www.ruby-forum.com/t/drop-down-menu-to-show-directories/147326 "2008-08-31T05:30:47Z")

</div>

Hi Guys, Can anyone recommend a way to have a drop down menu that show a list of directories? In my controller I have: @files = \[Dir.glob(’/mydirectoryofcoolfiles/\*’) \] Then the form I am unsure of how to do it: \<%…

---

## [Share hash between session? I need ASP Application Obj?](https://www.ruby-forum.com/t/share-hash-between-session-i-need-asp-application-obj/147302)

<div class="topic-metadata">

**Author:** [@mrpete](https://www.ruby-forum.com/u/mrpete)\
**Replies:** 1\
**Last updated:** [August 31, 2008, 4:42am UTC](https://www.ruby-forum.com/t/share-hash-between-session-i-need-asp-application-obj/147302 "2008-08-31T04:42:30Z")

</div>

Background: ASP has an Application\[\] collection that is shared across sessions. How do you do that in RoR? I need a mutex to read/write this as I need to share a hash across sessions. Thanks in advance, Pete

---

## [Bypassing session integrity check](https://www.ruby-forum.com/t/bypassing-session-integrity-check/147318)

<div class="topic-metadata">

**Author:** [@markh](https://www.ruby-forum.com/u/markh)\
**Replies:** 1\
**Last updated:** [August 31, 2008, 12:23am UTC](https://www.ruby-forum.com/t/bypassing-session-integrity-check/147318 "2008-08-31T00:23:07Z")

</div>

I’ve a PDA application that posts data to a RoR web app. But I don’t include a ‘authenticity\_token’ field and the server is returning ‘The change you wanted was rejected’. Removing ‘config.action\_controller.session’ f…

---

## [Plugin best practices](https://www.ruby-forum.com/t/plugin-best-practices/147314)

<div class="topic-metadata">

**Author:** [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Replies:** 1\
**Last updated:** [August 30, 2008, 11:33pm UTC](https://www.ruby-forum.com/t/plugin-best-practices/147314 "2008-08-30T23:33:10Z")

</div>

I’ve created plugins by using generators and by just creating the application directory structure in the plugin itself and putting the models, views,etc in the plugin. With the exception of migrations, I’m hard pres…

---

## [Working with sessions in beast forum](https://www.ruby-forum.com/t/working-with-sessions-in-beast-forum/147307)

<div class="topic-metadata">

**Author:** [@GearSSS\_id\_OSCealla](https://www.ruby-forum.com/u/GearSSS_id_OSCealla)\
**Replies:** 3\
**Last updated:** [August 30, 2008, 11:28pm UTC](https://www.ruby-forum.com/t/working-with-sessions-in-beast-forum/147307 "2008-08-30T23:28:28Z")

</div>

Hey, I’m designing an app which displays the events near a user in RoR. I’m using the beat forum to facilitate user management/sessions/etc. I’ve edited the sessions table in the Beast database to contain a “session\_…

---

## [Rails 2.1.0 doesn't find my rails app](https://www.ruby-forum.com/t/rails-2-1-0-doesnt-find-my-rails-app/147315)

<div class="topic-metadata">

**Author:** [@jfrankov](https://www.ruby-forum.com/u/jfrankov)\
**Replies:** 1\
**Last updated:** [August 30, 2008, 11:23pm UTC](https://www.ruby-forum.com/t/rails-2-1-0-doesnt-find-my-rails-app/147315 "2008-08-30T23:23:13Z")

</div>

I’m upgrading from rails 1.2.3 to 2.1.0. I got all my 1.2.3 tests to pass in 2.1.0 with no deprecation warnings, renamed my views, replaced all the config files with a fresh “rails --force /path/to/app” and fired up m…

---

## [Attachment\_fu && image caching](https://www.ruby-forum.com/t/attachment-fu-image-caching/147311)

<div class="topic-metadata">

**Author:** [@Valery\_K](https://www.ruby-forum.com/u/Valery_K)\
**Replies:** 0\
**Last updated:** [August 30, 2008, 9:50pm UTC](https://www.ruby-forum.com/t/attachment-fu-image-caching/147311 "2008-08-30T21:50:45Z")

</div>

I have a little problem: I’m operating with attachment\_fu object (:storage =\> :file\_system), for instance @image. When I have to render it into the view, i’d like to use native helper \< %= image\_tag(@image.public\_fil…

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

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