# Rails

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

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

---

## [Database optimization (ways to decrease the number of sql selects)](https://www.ruby-forum.com/t/database-optimization-ways-to-decrease-the-number-of-sql-selects/125465)

<div class="topic-metadata">

**Author:** [@blackflash](https://www.ruby-forum.com/u/blackflash)\
**Replies:** 5\
**Last updated:** [January 18, 2008, 1:46am UTC](https://www.ruby-forum.com/t/database-optimization-ways-to-decrease-the-number-of-sql-selects/125465 "2008-01-18T01:46:09Z")

</div>

Is there any way to optimize (decrease) SQL selects without using pure SQL (find\_by\_sql command)? Example: I have persons - professions (many to many relation), with only id and name columns to both tables. When a u…

---

## [Best way to do redirect\_to using multiple controllers?](https://www.ruby-forum.com/t/best-way-to-do-redirect-to-using-multiple-controllers/126338)

<div class="topic-metadata">

**Author:** [@daveamos](https://www.ruby-forum.com/u/daveamos)\
**Replies:** 4\
**Last updated:** [January 18, 2008, 12:57am UTC](https://www.ruby-forum.com/t/best-way-to-do-redirect-to-using-multiple-controllers/126338 "2008-01-18T00:57:25Z")

</div>

I’m using the same comment system for two different controllers, so users post a comment to a game and a post using the same “create” action in the comments controller. I did comments for games first, so my comments c…

---

## [Ruby Rocks!](https://www.ruby-forum.com/t/ruby-rocks/126403)

<div class="topic-metadata">

**Author:** [@xobani](https://www.ruby-forum.com/u/xobani)\
**Replies:** 0\
**Last updated:** [January 18, 2008, 12:56am UTC](https://www.ruby-forum.com/t/ruby-rocks/126403 "2008-01-18T00:56:27Z")

</div>

just wanted to say that i am a newbie and am learning RoR and IT ROCKS!!! nerd on!!

---

## [\_fu](https://www.ruby-forum.com/t/fu/126359)

<div class="topic-metadata">

**Author:** [@marksbrain](https://www.ruby-forum.com/u/marksbrain)\
**Replies:** 4\
**Last updated:** [January 18, 2008, 12:00am UTC](https://www.ruby-forum.com/t/fu/126359 "2008-01-18T00:00:23Z")

</div>

Other than sounding vaguely offensive, \_fu (as a suffix) means nothing to me. Could someone clue me in? ///ark

---

## [Implementing password confirmation](https://www.ruby-forum.com/t/implementing-password-confirmation/126375)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 2\
**Last updated:** [January 17, 2008, 11:37pm UTC](https://www.ruby-forum.com/t/implementing-password-confirmation/126375 "2008-01-17T23:37:25Z")

</div>

Hi, I’m using the latest version of RoR. I’m having a problem with passwords and password confirmations. I have a db table and corresponding model – customer with a password field (but no password confirmation fiel…

---

## [Submit button has no effect on the db](https://www.ruby-forum.com/t/submit-button-has-no-effect-on-the-db/126315)

<div class="topic-metadata">

**Author:** [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Replies:** 2\
**Last updated:** [January 17, 2008, 10:41pm UTC](https://www.ruby-forum.com/t/submit-button-has-no-effect-on-the-db/126315 "2008-01-17T22:41:36Z")

</div>

I think that the line with “@feed.tags \<\< Tag.find\_or\_create\_by\_tag(params \[:which\_tag\]) unless params\[:which\_tag\].blank?” isn’t correctly saving data. What I want to happen is that the user places a checkmark on a “…

---

## [Moving to Production](https://www.ruby-forum.com/t/moving-to-production/126353)

<div class="topic-metadata">

**Author:** [@pete](https://www.ruby-forum.com/u/pete)\
**Replies:** 7\
**Last updated:** [January 17, 2008, 10:14pm UTC](https://www.ruby-forum.com/t/moving-to-production/126353 "2008-01-17T22:14:39Z")

</div>

Hi- I’ve been happily rolling along creating my Rails apps and am at the point now where I need to keep my Development Environment and create a Production Environment. To do this, should I simply create the \_producti…

---

## [Pretty backtrace?](https://www.ruby-forum.com/t/pretty-backtrace/126383)

<div class="topic-metadata">

**Author:** [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Replies:** 0\
**Last updated:** [January 17, 2008, 9:57pm UTC](https://www.ruby-forum.com/t/pretty-backtrace/126383 "2008-01-17T21:57:53Z")

</div>

I know I can print my own backtrace for an exception with exception.backtrace.join("\\n") But when an uncaught exception goes all the way up to Rails handler, Rails prints out a nice prettified stacktrace that’s a bit …

---

## [Trying to put ruby code in an if then statement in .rhtml](https://www.ruby-forum.com/t/trying-to-put-ruby-code-in-an-if-then-statement-in-rhtml/126378)

<div class="topic-metadata">

**Author:** [@railsnewb](https://www.ruby-forum.com/u/railsnewb)\
**Replies:** 8\
**Last updated:** [January 17, 2008, 9:54pm UTC](https://www.ruby-forum.com/t/trying-to-put-ruby-code-in-an-if-then-statement-in-rhtml/126378 "2008-01-17T21:54:59Z")

</div>

This code, in my view(.rhtml file) causes the error which I’ll post below. -----The Code----- \<%= if (@announcement.image == nil) then Download end %\> ----The Error---- compile error ./script/…/config/…/app/views…

---

## [Forms, database, and yes I'm new](https://www.ruby-forum.com/t/forms-database-and-yes-im-new/126321)

<div class="topic-metadata">

**Author:** [@kaizerkaizer](https://www.ruby-forum.com/u/kaizerkaizer)\
**Replies:** 2\
**Last updated:** [January 17, 2008, 9:29pm UTC](https://www.ruby-forum.com/t/forms-database-and-yes-im-new/126321 "2008-01-17T21:29:39Z")

</div>

I have a quick question on a problem of mine. I’ve done the ONLamp tutorial with scaffolding a recipe etc, and honesly I didn’t get really any wiser. So I decided to try it out on my own without scaffolding. However…

---

## [Link\_to and firefox](https://www.ruby-forum.com/t/link-to-and-firefox/126157)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 2\
**Last updated:** [January 17, 2008, 9:10pm UTC](https://www.ruby-forum.com/t/link-to-and-firefox/126157 "2008-01-17T21:10:20Z")

</div>

I ve got the following in my code: link\_to “Prev Month” , {:controller =\> “rind\_kalender”, :action =\> “index”, :planday =\> h(@plan\_day \<\< 1)} , :class =\> “prevMonth” controller and action are my default controller and…

---

## [Easy way to experiment with helpers?](https://www.ruby-forum.com/t/easy-way-to-experiment-with-helpers/126376)

<div class="topic-metadata">

**Author:** [@Pito](https://www.ruby-forum.com/u/Pito)\
**Replies:** 0\
**Last updated:** [January 17, 2008, 8:43pm UTC](https://www.ruby-forum.com/t/easy-way-to-experiment-with-helpers/126376 "2008-01-17T20:43:06Z")

</div>

There are numerous interesting helpers such as FormHelper, FormTagHelper and so on and so on. I want to experiment with them in script/console. What’s an easy way to get to them from there?

---

## [How to put a method to execute in every page view?](https://www.ruby-forum.com/t/how-to-put-a-method-to-execute-in-every-page-view/126365)

<div class="topic-metadata">

**Author:** [@Vinicius\_Cubas\_B](https://www.ruby-forum.com/u/Vinicius_Cubas_B)\
**Replies:** 3\
**Last updated:** [January 17, 2008, 8:12pm UTC](https://www.ruby-forum.com/t/how-to-put-a-method-to-execute-in-every-page-view/126365 "2008-01-17T20:12:19Z")

</div>

Hello. I want to execute a method in every page view, in my Rails application. It will be for a customized log plugin. So, how do I do that and where is the proper place to put the method call? thank you

---

## [\[ADV\] The Ruport Book : Your guide to mastering Ruby Reports](https://www.ruby-forum.com/t/adv-the-ruport-book-your-guide-to-mastering-ruby-reports/196574)

<div class="topic-metadata">

**Author:** [@naething](https://www.ruby-forum.com/u/naething)\
**Replies:** 3\
**Last updated:** [January 17, 2008, 8:05pm UTC](https://www.ruby-forum.com/t/adv-the-ruport-book-your-guide-to-mastering-ruby-reports/196574 "2008-01-17T20:05:11Z")

</div>

Hi folks, I am pleased to announce that Mike Milner and I have finished the Ruport Book. We have published it under our own company (Rinara Press LLC) through Lulu. With the help of the Ruport community, we’ve refin…

---

## [Querying Rails 4 Table & Field list](https://www.ruby-forum.com/t/querying-rails-4-table-field-list/126369)

<div class="topic-metadata">

**Author:** [@ptremblett](https://www.ruby-forum.com/u/ptremblett)\
**Replies:** 1\
**Last updated:** [January 17, 2008, 7:50pm UTC](https://www.ruby-forum.com/t/querying-rails-4-table-field-list/126369 "2008-01-17T19:50:59Z")

</div>

I’ve been experimenting with migrations-- forward and back. Sometimes… I forget where I am in a series of migration steps. I know I can open the database with a mySQL utility to see which fields exist and which don’t.…

---

## [How to fix caching](https://www.ruby-forum.com/t/how-to-fix-caching/126271)

<div class="topic-metadata">

**Author:** [@katsnelson](https://www.ruby-forum.com/u/katsnelson)\
**Replies:** 1\
**Last updated:** [January 17, 2008, 7:38pm UTC](https://www.ruby-forum.com/t/how-to-fix-caching/126271 "2008-01-17T19:38:58Z")

</div>

Hi all, Basically I need to turn off caching on 100%, but maybe something else will help. I have a next problem - in main layout: \<% if current\_user and current\_user != :false %\> \<% else %\> \<% end %\> if I l…

---

## [ActionMailer email error](https://www.ruby-forum.com/t/actionmailer-email-error/126368)

<div class="topic-metadata">

**Author:** [@a2ahmad](https://www.ruby-forum.com/u/a2ahmad)\
**Replies:** 0\
**Last updated:** [January 17, 2008, 7:36pm UTC](https://www.ruby-forum.com/t/actionmailer-email-error/126368 "2008-01-17T19:36:18Z")

</div>

Hi guys, Not sure what is wrong with my emailing. I suspected it has to do with the environment config but it looks fine to me. The error I get is: Errno::ECONNRESET in EmailController#remind An existing connection …

---

## [Pagination for 2 unrelated tables](https://www.ruby-forum.com/t/pagination-for-2-unrelated-tables/126367)

<div class="topic-metadata">

**Author:** [@tornado](https://www.ruby-forum.com/u/tornado)\
**Replies:** 0\
**Last updated:** [January 17, 2008, 7:33pm UTC](https://www.ruby-forum.com/t/pagination-for-2-unrelated-tables/126367 "2008-01-17T19:33:23Z")

</div>

I have a business requirement where we have to display contents from 2 tables as paginated result… We have been using paginating\_find successfully for a single table… any ideas about how to go about this problem ? th…

---

## [Collection\_select unique value](https://www.ruby-forum.com/t/collection-select-unique-value/126366)

<div class="topic-metadata">

**Author:** [@joan2kus](https://www.ruby-forum.com/u/joan2kus)\
**Replies:** 0\
**Last updated:** [January 17, 2008, 7:23pm UTC](https://www.ruby-forum.com/t/collection-select-unique-value/126366 "2008-01-17T19:23:54Z")

</div>

I have a table named “posts” with an “author” attribute. At the posts index page, the user should be able to sort the posts through a drop down list that contains the author name. My problem is, when I use form option…

---

## [To query multiple tables](https://www.ruby-forum.com/t/to-query-multiple-tables/126322)

<div class="topic-metadata">

**Author:** [@bpankaj](https://www.ruby-forum.com/u/bpankaj)\
**Replies:** 4\
**Last updated:** [January 17, 2008, 6:59pm UTC](https://www.ruby-forum.com/t/to-query-multiple-tables/126322 "2008-01-17T18:59:11Z")

</div>

Hi every body, I have a database containing around 15 tables. There are lots of relationships. Now if I need to add a query involving say 8 tables(a,b,c,d,e,f,g,h) can I do it using find\_by\_sql. If so where do I impl…

---

## [Rails dev logs](https://www.ruby-forum.com/t/rails-dev-logs/126360)

<div class="topic-metadata">

**Author:** [@Shawn\_Page](https://www.ruby-forum.com/u/Shawn_Page)\
**Replies:** 2\
**Last updated:** [January 17, 2008, 6:52pm UTC](https://www.ruby-forum.com/t/rails-dev-logs/126360 "2008-01-17T18:52:09Z")

</div>

How does rails compute the timing/summary information in the dev logs? e.g. Completed in 0.84545 (1 reqs/sec) | Rendering: 0.00029 (0%) | DB: 0.11569 (13%) | 200 OK \[http://localhost/installations/123\] -Shawn

---

## [Multiple views, and some routers](https://www.ruby-forum.com/t/multiple-views-and-some-routers/126344)

<div class="topic-metadata">

**Author:** [@andreh](https://www.ruby-forum.com/u/andreh)\
**Replies:** 4\
**Last updated:** [January 17, 2008, 6:24pm UTC](https://www.ruby-forum.com/t/multiple-views-and-some-routers/126344 "2008-01-17T18:24:38Z")

</div>

Hi, I’m new to Rails (just a Java Programmer tired of having to configure a lot of xml’s and mapping classes just to make a simple page (…)) anyway, I’m experiencing some problems with routers, i’ve created a new pro…

---

## [Website Controllers Project](https://www.ruby-forum.com/t/website-controllers-project/126357)

<div class="topic-metadata">

**Author:** [@kopf1988](https://www.ruby-forum.com/u/kopf1988)\
**Replies:** 1\
**Last updated:** [January 17, 2008, 6:08pm UTC](https://www.ruby-forum.com/t/website-controllers-project/126357 "2008-01-17T18:08:25Z")

</div>

Okay, so right now I am working on my master website controlling rails program, that will control the static page on many websites (and then editing, and much more). I am trying to figure out the best way to do this a…

---

## [File upload with lighttpd](https://www.ruby-forum.com/t/file-upload-with-lighttpd/126351)

<div class="topic-metadata">

**Author:** [@deliak](https://www.ruby-forum.com/u/deliak)\
**Replies:** 1\
**Last updated:** [January 17, 2008, 5:44pm UTC](https://www.ruby-forum.com/t/file-upload-with-lighttpd/126351 "2008-01-17T17:44:58Z")

</div>

Hi. I’m running a rails app with lighttpd 1.4.18 and fcgi. Whenever I try to upload a file larger then 1Mb or so I get a “503 - Service Not Available” error. Any clue?

---

## [Anyone know how to install RoR for Fedora/Redhat Linux and Apache 2?](https://www.ruby-forum.com/t/anyone-know-how-to-install-ror-for-fedora-redhat-linux-and-apache-2/126352)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 1\
**Last updated:** [January 17, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/anyone-know-how-to-install-ror-for-fedora-redhat-linux-and-apache-2/126352 "2008-01-17T17:24:28Z")

</div>

Hi, I’m coming up empty on Google for a good step-by-step instruction process for installing Ruby on Rails for Fedora Core 6 Linux or the Redhat equivalent on Apache 2. Anything you used would be greatly appreciated…

---

## [Documentation for simply\_helpful features rolled into rails 2](https://www.ruby-forum.com/t/documentation-for-simply-helpful-features-rolled-into-rails-2/126346)

<div class="topic-metadata">

**Author:** [@ant](https://www.ruby-forum.com/u/ant)\
**Replies:** 0\
**Last updated:** [January 17, 2008, 4:27pm UTC](https://www.ruby-forum.com/t/documentation-for-simply-helpful-features-rolled-into-rails-2/126346 "2008-01-17T16:27:59Z")

</div>

Hi All, In Ryan B. screencast episode 80 (Ruby on Rails Screencasts - RailsCasts 80) on simplifying views in rails he mentions that \<% render :partial =\>‘product’ , :collection =\> @products %\> and \<% render :partial …

---

## [Set\_belongs\_to\_association\_for](https://www.ruby-forum.com/t/set-belongs-to-association-for/126336)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 0\
**Last updated:** [January 17, 2008, 3:05pm UTC](https://www.ruby-forum.com/t/set-belongs-to-association-for/126336 "2008-01-17T15:05:03Z")

</div>

I have a question on “ActiveRecord::Associations::AssociationProxy.set\_belongs\_to\_association\_for” it is a protected method. def set\_belongs\_to\_association\_for(record) if @reflection.options\[:as\] rec…

---

## [Pagenation to list selected items](https://www.ruby-forum.com/t/pagenation-to-list-selected-items/126333)

<div class="topic-metadata">

**Author:** [@madhan](https://www.ruby-forum.com/u/madhan)\
**Replies:** 0\
**Last updated:** [January 17, 2008, 2:59pm UTC](https://www.ruby-forum.com/t/pagenation-to-list-selected-items/126333 "2008-01-17T14:59:41Z")

</div>

hi all, i want to display 5 orders in a page from an orders table. so i used… i m getting startDate and endDate as parameters. @orders\_pages, @orders = paginate(:orders, :conditions =\>\[“ordered\_on \> ? and ordered\_on…

---

## [Activerecord with JDBC in JRuby](https://www.ruby-forum.com/t/activerecord-with-jdbc-in-jruby/124245)

<div class="topic-metadata">

**Author:** [@giorgio](https://www.ruby-forum.com/u/giorgio)\
**Replies:** 1\
**Last updated:** [January 17, 2008, 1:46pm UTC](https://www.ruby-forum.com/t/activerecord-with-jdbc-in-jruby/124245 "2008-01-17T13:46:10Z")

</div>

I have some code that works in “normal” RoR. It doesn’t work in JRuby with the MySql JDBC adapter. The query is: @breakdowns = Client.find(:all, :select =\> breakdown\_select, :conditions =\>breakdown\_conditions , :j…

---

## [How to replace keywords with values to merge into an email template](https://www.ruby-forum.com/t/how-to-replace-keywords-with-values-to-merge-into-an-email-template/124832)

<div class="topic-metadata">

**Author:** [@tonypm](https://www.ruby-forum.com/u/tonypm)\
**Replies:** 7\
**Last updated:** [January 17, 2008, 1:34pm UTC](https://www.ruby-forum.com/t/how-to-replace-keywords-with-values-to-merge-into-an-email-template/124832 "2008-01-17T13:34:50Z")

</div>

I am making an email template system, in which certain keywords are to be replaced by values from the model. eg {ORDERNO}, {NAME} etc My plan is to do the following. find all keywords in the text (subject and body a…

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

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