# Rails

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

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

---

## [Protecting the code](https://www.ruby-forum.com/t/protecting-the-code/149276)

<div class="topic-metadata">

**Author:** [@rubyman77](https://www.ruby-forum.com/u/rubyman77)\
**Replies:** 3\
**Last updated:** [September 23, 2008, 6:31pm UTC](https://www.ruby-forum.com/t/protecting-the-code/149276 "2008-09-23T18:31:39Z")

</div>

We are just starting a new project and it is going to be a commercial application. So we have a reasonable question now - how can we protect our code? I have searched the web but found nothing really useful. Can anyon…

---

## [DATABASE Query performance](https://www.ruby-forum.com/t/database-query-performance/149187)

<div class="topic-metadata">

**Author:** [@Barun\_A](https://www.ruby-forum.com/u/Barun_A)\
**Replies:** 31\
**Last updated:** [September 23, 2008, 6:22pm UTC](https://www.ruby-forum.com/t/database-query-performance/149187 "2008-09-23T18:22:49Z")

</div>

Hi Everybody Suppose We have two models named Book and Author. Make a suggestion on how we will improve the database query performance on the following code. books = Book.find(:all) books.each do | book | puts boo…

---

## [Calling save in after\_create hook](https://www.ruby-forum.com/t/calling-save-in-after-create-hook/149313)

<div class="topic-metadata">

**Author:** [@noelw](https://www.ruby-forum.com/u/noelw)\
**Replies:** 3\
**Last updated:** [September 23, 2008, 6:20pm UTC](https://www.ruby-forum.com/t/calling-save-in-after-create-hook/149313 "2008-09-23T18:20:43Z")

</div>

Scenario: I’m creating an image file upload service for my web site. As well as saving the actual file I also need to create a database record for the file. I would like to name the file after the record id, but I al…

---

## [Problem with set\_table\_name and custom method in model](https://www.ruby-forum.com/t/problem-with-set-table-name-and-custom-method-in-model/148328)

<div class="topic-metadata">

**Author:** [@rgagnon](https://www.ruby-forum.com/u/rgagnon)\
**Replies:** 4\
**Last updated:** [September 23, 2008, 5:52pm UTC](https://www.ruby-forum.com/t/problem-with-set-table-name-and-custom-method-in-model/148328 "2008-09-23T17:52:14Z")

</div>

Hi, When I try to run this command I got a table does not exist. Vehicule.get\_vehicule(123,1123) class Vehicule \< ActiveRecord::Base set\_table\_name “table\_a” def self.get\_vehicule( inte\_no, poas\_no) find\_by\_int…

---

## [Install FreeImage/ImageScience on Leopard](https://www.ruby-forum.com/t/install-freeimage-imagescience-on-leopard/128363)

<div class="topic-metadata">

**Author:** [@angelRamirez](https://www.ruby-forum.com/u/angelRamirez)\
**Replies:** 6\
**Last updated:** [September 23, 2008, 4:39pm UTC](https://www.ruby-forum.com/t/install-freeimage-imagescience-on-leopard/128363 "2008-09-23T16:39:03Z")

</div>

Hello - I am trying to install FreeImage on OSX 10.5 and am having trouble. I have tried both via mac ports as well as source install and can’t get it to work. Also, I have installed dev sdk tools from the Leopard di…

---

## [Syntax error in RJS](https://www.ruby-forum.com/t/syntax-error-in-rjs/149231)

<div class="topic-metadata">

**Author:** [@jimgroom](https://www.ruby-forum.com/u/jimgroom)\
**Replies:** 3\
**Last updated:** [September 23, 2008, 4:12pm UTC](https://www.ruby-forum.com/t/syntax-error-in-rjs/149231 "2008-09-23T16:12:44Z")

</div>

I’m new to Ruby on Rails and came across a problem I could not solve alone. I’ve a pretty simple RJS file that looks like the following: 3.times do page.insert\_html :bottom, ‘messages’, ‘test’ end page.call ‘update…

---

## [Unicode character conversion](https://www.ruby-forum.com/t/unicode-character-conversion/149319)

<div class="topic-metadata">

**Author:** [@railsnewb](https://www.ruby-forum.com/u/railsnewb)\
**Replies:** 0\
**Last updated:** [September 23, 2008, 4:11pm UTC](https://www.ruby-forum.com/t/unicode-character-conversion/149319 "2008-09-23T16:11:20Z")

</div>

Hi, I am working on a web stie which requires unicode support. I mostly works; I have spent few days on the following issues with no solution so any help is very much appreciated.: I would like to decompose a unico…

---

## [Using test block in unit testing](https://www.ruby-forum.com/t/using-test-block-in-unit-testing/149317)

<div class="topic-metadata">

**Author:** [@Hunt\_J](https://www.ruby-forum.com/u/Hunt_J)\
**Replies:** 1\
**Last updated:** [September 23, 2008, 4:09pm UTC](https://www.ruby-forum.com/t/using-test-block-in-unit-testing/149317 "2008-09-23T16:09:30Z")

</div>

I saw some code using a block like: test “describing the test” do assert true end in unit test code. But I can’t get it to work. Is there any thing to do (requiring a gem)? This is an alternative way to write def …

---

## [Problem with creating stub for model "Address"](https://www.ruby-forum.com/t/problem-with-creating-stub-for-model-address/149318)

<div class="topic-metadata">

**Author:** [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Replies:** 0\
**Last updated:** [September 23, 2008, 3:57pm UTC](https://www.ruby-forum.com/t/problem-with-creating-stub-for-model-address/149318 "2008-09-23T15:57:46Z")

</div>

Hi, I have model name “Address”. class Address \< ActiveRecord::Base end And I have written the stub for this model. define Address do belongs\_to :addressable, :polymorphic =\> true methods :id =\> 1, :full\_name …

---

## [Make Private Uploaded File](https://www.ruby-forum.com/t/make-private-uploaded-file/149238)

<div class="topic-metadata">

**Author:** [@nik](https://www.ruby-forum.com/u/nik)\
**Replies:** 3\
**Last updated:** [September 23, 2008, 3:43pm UTC](https://www.ruby-forum.com/t/make-private-uploaded-file/149238 "2008-09-23T15:43:35Z")

</div>

Hello all, I asked this question yesterday but seem to get no response, maybe there’s a code about how much I should explain before an answer is deserved or maybe it was confusingly stated. But let me try again: If I…

---

## [Converting the following sql](https://www.ruby-forum.com/t/converting-the-following-sql/149314)

<div class="topic-metadata">

**Author:** [@bskaggs](https://www.ruby-forum.com/u/bskaggs)\
**Replies:** 3\
**Last updated:** [September 23, 2008, 3:35pm UTC](https://www.ruby-forum.com/t/converting-the-following-sql/149314 "2008-09-23T15:35:52Z")

</div>

i have a query, i need to transfer this using all the find conditions etc, can anyone give me a few pointers? select \* from outcomes o1 where o1.outcome\_date = (select max(o2.outcome\_date) from outcomes o2 where o2.te…

---

## [Cookie crazy](https://www.ruby-forum.com/t/cookie-crazy/149306)

<div class="topic-metadata">

**Author:** [@david](https://www.ruby-forum.com/u/david)\
**Replies:** 2\
**Last updated:** [September 23, 2008, 3:02pm UTC](https://www.ruby-forum.com/t/cookie-crazy/149306 "2008-09-23T15:02:25Z")

</div>

We have a site that does not really use any cookies. However, after login a cookie is set by a 3rd party company. Therefore, we are www.mycompany.com and they are www.3rdpartycompany.com. If the user pressed back a…

---

## [HowTo create a Time object and set the TZ-offset](https://www.ruby-forum.com/t/howto-create-a-time-object-and-set-the-tz-offset/149315)

<div class="topic-metadata">

**Author:** [@jeanluca](https://www.ruby-forum.com/u/jeanluca)\
**Replies:** 0\
**Last updated:** [September 23, 2008, 3:02pm UTC](https://www.ruby-forum.com/t/howto-create-a-time-object-and-set-the-tz-offset/149315 "2008-09-23T15:02:11Z")

</div>

Hi All I need to make a Time object and set the timezone offset. Anyone an example ? Right now it uses the default TZ of my RoR project! Thnx a lot Lucas

---

## [Custom test output](https://www.ruby-forum.com/t/custom-test-output/149298)

<div class="topic-metadata">

**Author:** [@davidtl](https://www.ruby-forum.com/u/davidtl)\
**Replies:** 2\
**Last updated:** [September 23, 2008, 2:46pm UTC](https://www.ruby-forum.com/t/custom-test-output/149298 "2008-09-23T14:46:31Z")

</div>

I would like some of my functional tests to output something additional to the standard output. It could be directly in the terminal, in the test log, or somewhere else. How can I do that? Thanks in advance! (:

---

## [Questions on Active Record SQL type Finders & Dynamic Finder](https://www.ruby-forum.com/t/questions-on-active-record-sql-type-finders-dynamic-finder/149312)

<div class="topic-metadata">

**Author:** [@webreservoir](https://www.ruby-forum.com/u/webreservoir)\
**Replies:** 0\
**Last updated:** [September 23, 2008, 2:28pm UTC](https://www.ruby-forum.com/t/questions-on-active-record-sql-type-finders-dynamic-finder/149312 "2008-09-23T14:28:26Z")

</div>

Hi, I understand there are total 11 types of key Options for finding a record. The all 11 valid keys for the options hash are :conditions, :include, :order, :select, :group, :joins, :from, :limit, :offset, :readonly…

---

## [How can I override a partial from a plugin? where does "render" look for partials?](https://www.ruby-forum.com/t/how-can-i-override-a-partial-from-a-plugin-where-does-render-look-for-partials/149264)

<div class="topic-metadata">

**Author:** [@greg](https://www.ruby-forum.com/u/greg)\
**Replies:** 1\
**Last updated:** [September 23, 2008, 2:22pm UTC](https://www.ruby-forum.com/t/how-can-i-override-a-partial-from-a-plugin-where-does-render-look-for-partials/149264 "2008-09-23T14:22:12Z")

</div>

Hi, I’d like to override a particular partial from a plugin. In fact what I’d really like to do is somehow “alias” it so I can effectively add to the HTML that the partial creates. So I’d like to effectively do som…

---

## [Format.js in IE6](https://www.ruby-forum.com/t/format-js-in-ie6/149294)

<div class="topic-metadata">

**Author:** [@sijo](https://www.ruby-forum.com/u/sijo)\
**Replies:** 2\
**Last updated:** [September 23, 2008, 2:20pm UTC](https://www.ruby-forum.com/t/format-js-in-ie6/149294 "2008-09-23T14:20:26Z")

</div>

Hi I have the code @service\_desk\_resolution=ServiceDeskResolution.find @sd\_resolution\_id @sd\_resolv=ServiceDeskResolutionEffort.new @ret\_val=@sd\_resolv.checkdata(@sd\_effort) error\_value=0 respond\_to do |format| @e…

---

## [Need help with AJAX partial not refreshing browser asking to save .js instead](https://www.ruby-forum.com/t/need-help-with-ajax-partial-not-refreshing-browser-asking-to-save-js-instead/149295)

<div class="topic-metadata">

**Author:** [@tyliong](https://www.ruby-forum.com/u/tyliong)\
**Replies:** 1\
**Last updated:** [September 23, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/need-help-with-ajax-partial-not-refreshing-browser-asking-to-save-js-instead/149295 "2008-09-23T13:59:51Z")

</div>

Hi, when i use the updatepassword action, it does not refresh the ajax partial but forces the browser to save a file why does that happen? def updatepassword @user = current\_user return unless request.post? if User…

---

## [\[NEWBIE\] How to (pre-)process custom content types for model object creation?](https://www.ruby-forum.com/t/newbie-how-to-pre-process-custom-content-types-for-model-object-creation/149223)

<div class="topic-metadata">

**Author:** [@FMFMFM](https://www.ruby-forum.com/u/FMFMFM)\
**Replies:** 4\
**Last updated:** [September 23, 2008, 1:42pm UTC](https://www.ruby-forum.com/t/newbie-how-to-pre-process-custom-content-types-for-model-object-creation/149223 "2008-09-23T13:42:15Z")

</div>

Hi all, I have the following scenario: I scaffolded a resource R and in the generated create method I have the code that responds to html and xml. Basically by POSTing to the URI I can create entities either via forms …

---

## [Exception\_logger and protect\_from\_forgery](https://www.ruby-forum.com/t/exception-logger-and-protect-from-forgery/149305)

<div class="topic-metadata">

**Author:** [@phil](https://www.ruby-forum.com/u/phil)\
**Replies:** 0\
**Last updated:** [September 23, 2008, 1:10pm UTC](https://www.ruby-forum.com/t/exception-logger-and-protect-from-forgery/149305 "2008-09-23T13:10:34Z")

</div>

I am having a problem using the exception\_logger plugin when I have protect\_from\_forgery enabled. Here is the line from application.rb: protect\_from\_forgery :secret =\> ‘xxxx’ But I am getting: No :secret given to th…

---

## [Intermittent BJ errors](https://www.ruby-forum.com/t/intermittent-bj-errors/134238)

<div class="topic-metadata">

**Author:** [@Nic\_Deakins](https://www.ruby-forum.com/u/Nic_Deakins)\
**Replies:** 7\
**Last updated:** [September 23, 2008, 11:16am UTC](https://www.ruby-forum.com/t/intermittent-bj-errors/134238 "2008-09-23T11:16:19Z")

</div>

hi all I’m running background tasks using BJ 1.0.1 (gem version). On some requests, the tasks are executed as expected. On others, I get the following error: RuntimeError (no bj found in \["/u/apps/igniter/releases/20…

---

## [Problem with route.rb file](https://www.ruby-forum.com/t/problem-with-route-rb-file/149175)

<div class="topic-metadata">

**Author:** [@jon](https://www.ruby-forum.com/u/jon)\
**Replies:** 8\
**Last updated:** [September 23, 2008, 10:49am UTC](https://www.ruby-forum.com/t/problem-with-route-rb-file/149175 "2008-09-23T10:49:59Z")

</div>

I’m relative novice at RoR and I’ve just built my first application w/ o a tutorial that allows a user to login, buy products, and read/ create reviews about the product. So the basic structure is like this…there is a…

---

## [Polymorphic Controllers and Views](https://www.ruby-forum.com/t/polymorphic-controllers-and-views/149173)

<div class="topic-metadata">

**Author:** [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Replies:** 7\
**Last updated:** [September 23, 2008, 10:28am UTC](https://www.ruby-forum.com/t/polymorphic-controllers-and-views/149173 "2008-09-23T10:28:13Z")

</div>

How can I maintain DRY code on polymorphic controllers and views? For example, I am building an app where users have many posts and at the same time a group can have many posts and a category can be related to many po…

---

## [Need help related with prince library](https://www.ruby-forum.com/t/need-help-related-with-prince-library/149292)

<div class="topic-metadata">

**Author:** [@Abhishek\_shukla](https://www.ruby-forum.com/u/Abhishek_shukla)\
**Replies:** 0\
**Last updated:** [September 23, 2008, 10:25am UTC](https://www.ruby-forum.com/t/need-help-related-with-prince-library/149292 "2008-09-23T10:25:18Z")

</div>

Hello friend i am generating a pdf from html using prince library everything is working fine. but now my requirment is to save in file system but i am not able to do that can u plz help me out with that… Thanks in a…

---

## [Does anyone encounter this weird partial problem?](https://www.ruby-forum.com/t/does-anyone-encounter-this-weird-partial-problem/149290)

<div class="topic-metadata">

**Author:** [@gaoxt1983](https://www.ruby-forum.com/u/gaoxt1983)\
**Replies:** 0\
**Last updated:** [September 23, 2008, 10:13am UTC](https://www.ruby-forum.com/t/does-anyone-encounter-this-weird-partial-problem/149290 "2008-09-23T10:13:31Z")

</div>

when I have an exception in partial, instead of giving me backtrace of the exception, rails stopped render the partial and template, which makes the template looks wrong.

---

## [Help with "No route matches "/MyTest/" with {:method=\>:get}"](https://www.ruby-forum.com/t/help-with-no-route-matches-mytest-with-method-get/149289)

<div class="topic-metadata">

**Author:** [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Replies:** 1\
**Last updated:** [September 23, 2008, 9:58am UTC](https://www.ruby-forum.com/t/help-with-no-route-matches-mytest-with-method-get/149289 "2008-09-23T09:58:55Z")

</div>

I just started working with Ruby. Anyways I can’t seem to figure out how to have this message disappear. I was reading a tutorial and based on it, when I type in http://localhost:3000/MyTest/ it should say whatever I …

---

## [New user, please help!](https://www.ruby-forum.com/t/new-user-please-help/149167)

<div class="topic-metadata">

**Author:** [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Replies:** 3\
**Last updated:** [September 23, 2008, 9:49am UTC](https://www.ruby-forum.com/t/new-user-please-help/149167 "2008-09-23T09:49:31Z")

</div>

Hi, I’m new to everything so I was just reading this apple page trying to get things set up. http://developer.apple.com/tools/developonrailsleopard.html Anyways I get to the “sudo gem update sqlite3-ruby” step after r…

---

## [Authenticating using wordpress authentication system](https://www.ruby-forum.com/t/authenticating-using-wordpress-authentication-system/147383)

<div class="topic-metadata">

**Author:** [@Love\_AJAX](https://www.ruby-forum.com/u/Love_AJAX)\
**Replies:** 1\
**Last updated:** [September 23, 2008, 9:42am UTC](https://www.ruby-forum.com/t/authenticating-using-wordpress-authentication-system/147383 "2008-09-23T09:42:28Z")

</div>

Hi, I have integrated wordpress into a rails application. I am using Rails to build a few additional applications on top of Wordpress. Wordpress already has a user authentication system. I want to make use of this sy…

---

## [Custom Links in User Profile](https://www.ruby-forum.com/t/custom-links-in-user-profile/149269)

<div class="topic-metadata">

**Author:** [@kylemathews](https://www.ruby-forum.com/u/kylemathews)\
**Replies:** 2\
**Last updated:** [September 23, 2008, 9:42am UTC](https://www.ruby-forum.com/t/custom-links-in-user-profile/149269 "2008-09-23T09:42:27Z")

</div>

I want my users to be able to insert links in their profile, but obviously they can’t use html. I want to solve this by allowing them to do \[link=“http://theirurl.com”\]\[/link\]. Any idea how I would go about this? T…

---

## [Showing a Form](https://www.ruby-forum.com/t/showing-a-form/149253)

<div class="topic-metadata">

**Author:** [@Commander\_J](https://www.ruby-forum.com/u/Commander_J)\
**Replies:** 1\
**Last updated:** [September 23, 2008, 9:42am UTC](https://www.ruby-forum.com/t/showing-a-form/149253 "2008-09-23T09:42:27Z")

</div>

Hi, Thanks to Erol for giving me input on how to move stuff to a namespace. It meant some work, so next time I will spend more time thinking before blasting off. I’ve stored a Form in my DB which has Elements. Below…

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

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