# Rails

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

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

---

## [How to stop callbacks from getting called twice](https://www.ruby-forum.com/t/how-to-stop-callbacks-from-getting-called-twice/140441)

<div class="topic-metadata">

**Author:** [@kuma](https://www.ruby-forum.com/u/kuma)\
**Replies:** 0\
**Last updated:** [June 14, 2008, 12:29am UTC](https://www.ruby-forum.com/t/how-to-stop-callbacks-from-getting-called-twice/140441 "2008-06-14T00:29:57Z")

</div>

Maybe this is old news, but it took me all afternoon: In my test environment, an ‘after\_create’ callback was getting called twice unexpectedly. In my model, I had a simple ‘after\_create :foo’ declaration. From what …

---

## [Rails at a different document root?](https://www.ruby-forum.com/t/rails-at-a-different-document-root/140436)

<div class="topic-metadata">

**Author:** [@robb](https://www.ruby-forum.com/u/robb)\
**Replies:** 2\
**Last updated:** [June 13, 2008, 10:53pm UTC](https://www.ruby-forum.com/t/rails-at-a-different-document-root/140436 "2008-06-13T22:53:57Z")

</div>

Hi, I need my Rails app to not create internal URLs that begin with “/”, but rather something like “/rails”. Does anyone know where this would be configured? Basically, I’m building a setup with Rails behind Apache,…

---

## [Could explain syntax "||="?](https://www.ruby-forum.com/t/could-explain-syntax/140427)

<div class="topic-metadata">

**Author:** [@victordeandres](https://www.ruby-forum.com/u/victordeandres)\
**Replies:** 4\
**Last updated:** [June 13, 2008, 10:36pm UTC](https://www.ruby-forum.com/t/could-explain-syntax/140427 "2008-06-13T22:36:16Z")

</div>

I don’t understand the following syntax, the “||=” and “||nil” @country ||= (@current\_user.country || nil) anybody could explain please ?

---

## [TypeError (can't modify frozen hash) - Production Mode Only](https://www.ruby-forum.com/t/typeerror-cant-modify-frozen-hash-production-mode-only/140432)

<div class="topic-metadata">

**Author:** [@lottario](https://www.ruby-forum.com/u/lottario)\
**Replies:** 1\
**Last updated:** [June 13, 2008, 9:59pm UTC](https://www.ruby-forum.com/t/typeerror-cant-modify-frozen-hash-production-mode-only/140432 "2008-06-13T21:59:42Z")

</div>

Well, I’ve been testing out my code in production mode, in anticipation of being able to show off my site soon. Unfortunately, all is not going as expected. Production mode… well, its behaving differently than devel…

---

## [Bug in Rails 2.1.0 rendering partial "counter" starts at 1?](https://www.ruby-forum.com/t/bug-in-rails-2-1-0-rendering-partial-counter-starts-at-1/139209)

<div class="topic-metadata">

**Author:** [@eric99](https://www.ruby-forum.com/u/eric99)\
**Replies:** 4\
**Last updated:** [June 13, 2008, 9:57pm UTC](https://www.ruby-forum.com/t/bug-in-rails-2-1-0-rendering-partial-counter-starts-at-1/139209 "2008-06-13T21:57:10Z")

</div>

I just upgraded to Rails 2.1 and found that the “counter” property that exists while rendering a collection using a partial now starts at 1, instead of 0 (as before). I verified that this was working in Rails 2.0.2, …

---

## [Looking for fix to content-length = 1 byte with x\_sendfile](https://www.ruby-forum.com/t/looking-for-fix-to-content-length-1-byte-with-x-sendfile/139503)

<div class="topic-metadata">

**Author:** [@jamie](https://www.ruby-forum.com/u/jamie)\
**Replies:** 1\
**Last updated:** [June 13, 2008, 8:23pm UTC](https://www.ruby-forum.com/t/looking-for-fix-to-content-length-1-byte-with-x-sendfile/139503 "2008-06-13T20:23:05Z")

</div>

I am trying to use sendfile to send files and am using the :x\_sendfile =\> true option. I am experiencing problem that the content length of any file is truncated to 1 byte. The problem appears to be well documented -…

---

## [NoMethodError with my sessions controller?](https://www.ruby-forum.com/t/nomethoderror-with-my-sessions-controller/140416)

<div class="topic-metadata">

**Author:** [@dezrtdude](https://www.ruby-forum.com/u/dezrtdude)\
**Replies:** 2\
**Last updated:** [June 13, 2008, 6:29pm UTC](https://www.ruby-forum.com/t/nomethoderror-with-my-sessions-controller/140416 "2008-06-13T18:29:49Z")

</div>

Hi All, Can someone please explain the meaning of the following error: “NoMethodError (undefined method \`+’ for {:action=\>“new”, :controller=\>“sessions”}:Hash):” I have 3 controllers: TEAM, USER, SESSION If I creat…

---

## [Anonymous scopes against habtm relations](https://www.ruby-forum.com/t/anonymous-scopes-against-habtm-relations/140389)

<div class="topic-metadata">

**Author:** [@marzapower](https://www.ruby-forum.com/u/marzapower)\
**Replies:** 3\
**Last updated:** [June 13, 2008, 6:14pm UTC](https://www.ruby-forum.com/t/anonymous-scopes-against-habtm-relations/140389 "2008-06-13T18:14:34Z")

</div>

I need help for using anonymous scopes in my application. Consider the problem of two model linked by a habtm relation. Let them be: class FirstModel \< ActiveBase:Model has\_and\_belongs\_to\_many :second\_models end cl…

---

## [Adding custom conditions to map.resources](https://www.ruby-forum.com/t/adding-custom-conditions-to-map-resources/140415)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 0\
**Last updated:** [June 13, 2008, 6:03pm UTC](https://www.ruby-forum.com/t/adding-custom-conditions-to-map-resources/140415 "2008-06-13T18:03:19Z")

</div>

I’m doing some route hacking and have run into something I haven’t been able to get past. I need to add a custom condition on to RESTful resources in the same way that you can add custom conditions to other routes. I …

---

## [Newbie question on has\_many](https://www.ruby-forum.com/t/newbie-question-on-has-many/140410)

<div class="topic-metadata">

**Author:** [@david](https://www.ruby-forum.com/u/david)\
**Replies:** 6\
**Last updated:** [June 13, 2008, 5:51pm UTC](https://www.ruby-forum.com/t/newbie-question-on-has-many/140410 "2008-06-13T17:51:36Z")

</div>

I have two classes: a Widget and a User. The User has an id that is referenced in two places on the Widget: owner\_id and operator\_id. How should I structure that reference for has\_many? Thanks folks - I appreciate any…

---

## [Ruby On Rails Startup In Barcelona](https://www.ruby-forum.com/t/ruby-on-rails-startup-in-barcelona/140412)

<div class="topic-metadata">

**Author:** [@laurent](https://www.ruby-forum.com/u/laurent)\
**Replies:** 0\
**Last updated:** [June 13, 2008, 5:51pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-startup-in-barcelona/140412 "2008-06-13T17:51:35Z")

</div>

We are a startup company working on a confidential business project related to the distribution of consumer finance products in the Euro zone, starting with Spain. The company is founded by a seasoned industry expert…

---

## [Protect\_from\_forgery and search engines](https://www.ruby-forum.com/t/protect-from-forgery-and-search-engines/140413)

<div class="topic-metadata">

**Author:** [@harm](https://www.ruby-forum.com/u/harm)\
**Replies:** 0\
**Last updated:** [June 13, 2008, 5:42pm UTC](https://www.ruby-forum.com/t/protect-from-forgery-and-search-engines/140413 "2008-06-13T17:42:46Z")

</div>

Dear all, I’m using protect\_from\_forgery on my site but this prevents search engines from GETing some pages as protect\_from\_forgery requires a session to be present.The error is: ActionView::TemplateError occurred in…

---

## [Insert data into a db from xml or binary file](https://www.ruby-forum.com/t/insert-data-into-a-db-from-xml-or-binary-file/140411)

<div class="topic-metadata">

**Author:** [@mafloria](https://www.ruby-forum.com/u/mafloria)\
**Replies:** 0\
**Last updated:** [June 13, 2008, 5:39pm UTC](https://www.ruby-forum.com/t/insert-data-into-a-db-from-xml-or-binary-file/140411 "2008-06-13T17:39:50Z")

</div>

Hello… I need to insert data into 4 database tables. First i have a central table that i fill from a form. This form allows me to upload an image. Then I need to process that imagen generating an XML file. I call a C …

---

## [Model conditions](https://www.ruby-forum.com/t/model-conditions/140375)

<div class="topic-metadata">

**Author:** [@emuen](https://www.ruby-forum.com/u/emuen)\
**Replies:** 6\
**Last updated:** [June 13, 2008, 5:33pm UTC](https://www.ruby-forum.com/t/model-conditions/140375 "2008-06-13T17:33:38Z")

</div>

Hi. I got a model for banks accounts, each account has many bank\_account\_transactions. Each transaction has a from\_account\_id and a to\_account\_id. I’m trying to find all transactions both to and from the account with…

---

## [Is it Image::read or Image.read?](https://www.ruby-forum.com/t/is-it-image-read-or-image-read/140397)

<div class="topic-metadata">

**Author:** [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Replies:** 2\
**Last updated:** [June 13, 2008, 4:35pm UTC](https://www.ruby-forum.com/t/is-it-image-read-or-image-read/140397 "2008-06-13T16:35:27Z")

</div>

Using Rmagick, should it be Magick::Image::read or Magick::Image.read?

---

## [Link\_to problem with '.' in :id parameter (must be escaped!)](https://www.ruby-forum.com/t/link-to-problem-with-in-id-parameter-must-be-escaped/140372)

<div class="topic-metadata">

**Author:** [@teddio](https://www.ruby-forum.com/u/teddio)\
**Replies:** 1\
**Last updated:** [June 13, 2008, 4:32pm UTC](https://www.ruby-forum.com/t/link-to-problem-with-in-id-parameter-must-be-escaped/140372 "2008-06-13T16:32:08Z")

</div>

Hi, I have this very normal link\_to call: \<%= link\_to name, tag\_path(name) %\> The ‘name’ can be something like “ASP.NET”. That results in a URL like http://localhost:3000/tag/ASP.NET The Problem: I get a “no route” …

---

## [Charset problems with partials](https://www.ruby-forum.com/t/charset-problems-with-partials/107526)

<div class="topic-metadata">

**Author:** [@msojka](https://www.ruby-forum.com/u/msojka)\
**Replies:** 1\
**Last updated:** [June 13, 2008, 4:09pm UTC](https://www.ruby-forum.com/t/charset-problems-with-partials/107526 "2008-06-13T16:09:12Z")

</div>

Hi, When using partials, I’m not able to keep the text posted as ISO-8859-1, it changes to UTF-8. The browser detects the page as ISO-8859-1, but I know the string from the form is not ISO-8859-1 when given to the m…

---

## [Best respond\_to design practice](https://www.ruby-forum.com/t/best-respond-to-design-practice/140392)

<div class="topic-metadata">

**Author:** [@rickf](https://www.ruby-forum.com/u/rickf)\
**Replies:** 1\
**Last updated:** [June 13, 2008, 3:27pm UTC](https://www.ruby-forum.com/t/best-respond-to-design-practice/140392 "2008-06-13T15:27:34Z")

</div>

Hi All, I am in the middle of building a web service using the standard: # Return the appropriate response based on the type respond\_to do |format| format.html { render :layout =\> 'some layout' } format.xml { rend…

---

## [How do you access environment specific variables?](https://www.ruby-forum.com/t/how-do-you-access-environment-specific-variables/140385)

<div class="topic-metadata">

**Author:** [@chalkers](https://www.ruby-forum.com/u/chalkers)\
**Replies:** 1\
**Last updated:** [June 13, 2008, 1:16pm UTC](https://www.ruby-forum.com/t/how-do-you-access-environment-specific-variables/140385 "2008-06-13T13:16:20Z")

</div>

The documents seem a little out of date on the wiki http://wiki.rubyonrails.org/rails/pages/EnvironmentFiles http://wiki.rubyonrails.org/rails/pages/HowtoAddYourOwnConfigInfo I am trying to set a value for development…

---

## [What is the best linux version for rails project](https://www.ruby-forum.com/t/what-is-the-best-linux-version-for-rails-project/137221)

<div class="topic-metadata">

**Author:** [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Replies:** 15\
**Last updated:** [June 13, 2008, 1:16pm UTC](https://www.ruby-forum.com/t/what-is-the-best-linux-version-for-rails-project/137221 "2008-06-13T13:16:03Z")

</div>

what is the best linux version for rails project ? and what is the best databse for rails project ?

---

## [RAdio button onclick](https://www.ruby-forum.com/t/radio-button-onclick/140370)

<div class="topic-metadata">

**Author:** [@soutom](https://www.ruby-forum.com/u/soutom)\
**Replies:** 1\
**Last updated:** [June 13, 2008, 1:06pm UTC](https://www.ruby-forum.com/t/radio-button-onclick/140370 "2008-06-13T13:06:43Z")

</div>

i am trying to do some thing with radio button. my main tergate is that i have 2 radio button and 2 text field. when i click on a radio button1, then the corrosponding text field say text1 will b active, and another t…

---

## [Check variable defined and not nil](https://www.ruby-forum.com/t/check-variable-defined-and-not-nil/134555)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 7\
**Last updated:** [June 13, 2008, 1:06pm UTC](https://www.ruby-forum.com/t/check-variable-defined-and-not-nil/134555 "2008-06-13T13:06:18Z")

</div>

Does anyone know of a way to write a function (or the name of an existing function?) that will both check if a variable is defined, and ensure that it is non-nil? This has to be an uber-common problem, but hard to fig…

---

## [Operating systems supported by ffmpeg](https://www.ruby-forum.com/t/operating-systems-supported-by-ffmpeg/140257)

<div class="topic-metadata">

**Author:** [@sneha](https://www.ruby-forum.com/u/sneha)\
**Replies:** 3\
**Last updated:** [June 13, 2008, 1:04pm UTC](https://www.ruby-forum.com/t/operating-systems-supported-by-ffmpeg/140257 "2008-06-13T13:04:57Z")

</div>

Hi all, My project needs the audio format conversions. For the purpose i am using ffmpeg.exe and faad.exe. I am working on Windows XP, but my client’s opeating system is Open Solaris. I just needed to know whether t…

---

## [Xml builder scope](https://www.ruby-forum.com/t/xml-builder-scope/139563)

<div class="topic-metadata">

**Author:** [@chalkers](https://www.ruby-forum.com/u/chalkers)\
**Replies:** 3\
**Last updated:** [June 13, 2008, 1:02pm UTC](https://www.ruby-forum.com/t/xml-builder-scope/139563 "2008-06-13T13:02:10Z")

</div>

Hi All, I have just upgraded to rails 2.1 woop! All running smoothly but it seems that the instance variables aren’t being passed into my xml builder. Is there any particular reason I have over looked? Cheers Andre…

---

## [Ruby On Rails Startup In Barcelona](https://www.ruby-forum.com/t/ruby-on-rails-startup-in-barcelona/140383)

<div class="topic-metadata">

**Author:** [@laurent](https://www.ruby-forum.com/u/laurent)\
**Replies:** 0\
**Last updated:** [June 13, 2008, 1:00pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-startup-in-barcelona/140383 "2008-06-13T13:00:59Z")

</div>

We are a startup company working on a confidential business project related to the distribution of consumer finance products in the Euro zone, starting with Spain. The company is founded by a seasoned industry expert…

---

## [Rails won't reload my model](https://www.ruby-forum.com/t/rails-wont-reload-my-model/140361)

<div class="topic-metadata">

**Author:** [@dazuma](https://www.ruby-forum.com/u/dazuma)\
**Replies:** 1\
**Last updated:** [June 13, 2008, 12:58pm UTC](https://www.ruby-forum.com/t/rails-wont-reload-my-model/140361 "2008-06-13T12:58:14Z")

</div>

I have a class method in one of my models that I call from one of my controller, like this: def handle\_some\_uploaded\_file messages = MyModel.load\_something\_from\_file(params\[:data\_file\]) … end The thing is that when I…

---

## [Auto complete down arrow not working](https://www.ruby-forum.com/t/auto-complete-down-arrow-not-working/140244)

<div class="topic-metadata">

**Author:** [@srinathbtech](https://www.ruby-forum.com/u/srinathbtech)\
**Replies:** 2\
**Last updated:** [June 13, 2008, 12:30pm UTC](https://www.ruby-forum.com/t/auto-complete-down-arrow-not-working/140244 "2008-06-13T12:30:33Z")

</div>

Hi all, i was using auto complete feature in my rails app, when i used to type a character it responds very well and displays all the items match with that character. and now the thing is when i try to select any ite…

---

## [Asset\_host and ssl pages problem](https://www.ruby-forum.com/t/asset-host-and-ssl-pages-problem/140379)

<div class="topic-metadata">

**Author:** [@slonghurst](https://www.ruby-forum.com/u/slonghurst)\
**Replies:** 1\
**Last updated:** [June 13, 2008, 12:27pm UTC](https://www.ruby-forum.com/t/asset-host-and-ssl-pages-problem/140379 "2008-06-13T12:27:21Z")

</div>

I am configuring assets hosts for our site but am running into problems when navigating to an https page. Basically the server is trying to pull the assests out on https:// rather than http:/ but i do not have https c…

---

## [Rails, routes & subdomains](https://www.ruby-forum.com/t/rails-routes-subdomains/140346)

<div class="topic-metadata">

**Author:** [@polomasta](https://www.ruby-forum.com/u/polomasta)\
**Replies:** 1\
**Last updated:** [June 13, 2008, 11:15am UTC](https://www.ruby-forum.com/t/rails-routes-subdomains/140346 "2008-06-13T11:15:45Z")

</div>

I’ve tried a couple different things but can’t seem to get this to work. As part of my app I have a blog that is run at 应用宝官网-全网最新最热手机应用游戏下载 I would like to be able to setup so that blog.myapp.com points to that cont…

---

## [Uploading Large Files](https://www.ruby-forum.com/t/uploading-large-files/133470)

<div class="topic-metadata">

**Author:** [@jimmypalmer](https://www.ruby-forum.com/u/jimmypalmer)\
**Replies:** 7\
**Last updated:** [June 13, 2008, 10:43am UTC](https://www.ruby-forum.com/t/uploading-large-files/133470 "2008-06-13T10:43:39Z")

</div>

I built an app that allows users to purchase video files to download, but unfortunately media temple’s grid server isn’t letting me upload large files. Everything goes great unless the files are over 100 mb. I’m usin…

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

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