# Rails

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

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

---

## [Creating a custom function that can be called from an instance variable](https://www.ruby-forum.com/t/creating-a-custom-function-that-can-be-called-from-an-instance-variable/144460)

<div class="topic-metadata">

**Author:** [@nik](https://www.ruby-forum.com/u/nik)\
**Replies:** 3\
**Last updated:** [August 1, 2008, 3:24pm UTC](https://www.ruby-forum.com/t/creating-a-custom-function-that-can-be-called-from-an-instance-variable/144460 "2008-08-01T15:24:56Z")

</div>

Hello all, I have a whole bunch of time stamps which I need to display in fractional hours or fractional days as the case may be. Is there any chance I could do something like this: \<\> def HourDisp … end @time = …

---

## [:data, upload help](https://www.ruby-forum.com/t/data-upload-help/144725)

<div class="topic-metadata">

**Author:** [@rpierry](https://www.ruby-forum.com/u/rpierry)\
**Replies:** 0\
**Last updated:** [August 1, 2008, 3:22pm UTC](https://www.ruby-forum.com/t/data-upload-help/144725 "2008-08-01T15:22:26Z")

</div>

Hi, Im using the latest version of Rails and after reading Agile Web Developments with Rails which uses version 1.2.6 im wondering how to use the :data in a migration. Im wanting to provide an upload for my end user …

---

## [X-Accel-Redirect](https://www.ruby-forum.com/t/x-accel-redirect/144724)

<div class="topic-metadata">

**Author:** [@mikael](https://www.ruby-forum.com/u/mikael)\
**Replies:** 0\
**Last updated:** [August 1, 2008, 3:03pm UTC](https://www.ruby-forum.com/t/x-accel-redirect/144724 "2008-08-01T15:03:50Z")

</div>

Hello! I am using send\_file to manage my files on my website. But i heard that the best way to manage files with nginx is to use X-Accel-Redirect. Anyone who can explain how this work in a simple way. Thanks Svea

---

## [Pagination How to](https://www.ruby-forum.com/t/pagination-how-to/144718)

<div class="topic-metadata">

**Author:** [@mrbless](https://www.ruby-forum.com/u/mrbless)\
**Replies:** 0\
**Last updated:** [August 1, 2008, 2:21pm UTC](https://www.ruby-forum.com/t/pagination-how-to/144718 "2008-08-01T14:21:37Z")

</div>

hi guys i want to know how to do pagination in rails. I know how to do it with will paginate but my problem is something like this Lets say I have find from model something after that i will manipulate it using loop…

---

## [Problem with resources map](https://www.ruby-forum.com/t/problem-with-resources-map/144717)

<div class="topic-metadata">

**Author:** [@Muhammad\_Arslan\_Ali](https://www.ruby-forum.com/u/Muhammad_Arslan_Ali)\
**Replies:** 2\
**Last updated:** [August 1, 2008, 2:21pm UTC](https://www.ruby-forum.com/t/problem-with-resources-map/144717 "2008-08-01T14:21:02Z")

</div>

I am facing problem with resource map I have controller of artst class ArtistController \< ApplicationController in routes I have map.resources :artist and in view \<% for i in @artist %\> …

---

## [To\_xml and to\_json behaviour with nil values](https://www.ruby-forum.com/t/to-xml-and-to-json-behaviour-with-nil-values/144716)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 0\
**Last updated:** [August 1, 2008, 2:05pm UTC](https://www.ruby-forum.com/t/to-xml-and-to-json-behaviour-with-nil-values/144716 "2008-08-01T14:05:14Z")

</div>

Hi, i was wondering if there is any way to just skip attributes having nil values when to\_xml or to\_json on ActiveRecord. The default behavior is to include a nil value: xml: json: “identity\_url”: null Is there …

---

## [Creating Accounts with Subusers](https://www.ruby-forum.com/t/creating-accounts-with-subusers/144715)

<div class="topic-metadata">

**Author:** [@mroths](https://www.ruby-forum.com/u/mroths)\
**Replies:** 0\
**Last updated:** [August 1, 2008, 1:36pm UTC](https://www.ruby-forum.com/t/creating-accounts-with-subusers/144715 "2008-08-01T13:36:47Z")

</div>

In my model, I have Account has\_many Users. I’m using restful\_authentication, so I have the following routes and resources defined: map.resources :accounts map.resources :users map.resource :session, :controller =\> …

---

## [Strange update\_attributes behavior](https://www.ruby-forum.com/t/strange-update-attributes-behavior/144705)

<div class="topic-metadata">

**Author:** [@davidtl](https://www.ruby-forum.com/u/davidtl)\
**Replies:** 7\
**Last updated:** [August 1, 2008, 1:16pm UTC](https://www.ruby-forum.com/t/strange-update-attributes-behavior/144705 "2008-08-01T13:16:35Z")

</div>

Okay, let me explain my problem. I’ve got a form that looks like this: form\_remote\_for item, :url =\> list\_item\_path(item.list, item) do |f| %p = f.check\_box :completed, :onclick =\> ‘this.form.onsubmit()’, :index =\> …

---

## [REST error](https://www.ruby-forum.com/t/rest-error/144697)

<div class="topic-metadata">

**Author:** [@srijith](https://www.ruby-forum.com/u/srijith)\
**Replies:** 2\
**Last updated:** [August 1, 2008, 12:30pm UTC](https://www.ruby-forum.com/t/rest-error/144697 "2008-08-01T12:30:55Z")

</div>

Hi i given in routes.rb as map.resources :students, :member =\> \[:departments =\> :get\] and rhtml i given link \<td\>\<%=link\_to "Departments", departments\_student\_url(student) %\> in students controller def departments …

---

## [Improved find syntax in rails](https://www.ruby-forum.com/t/improved-find-syntax-in-rails/144702)

<div class="topic-metadata">

**Author:** [@xgamerx](https://www.ruby-forum.com/u/xgamerx)\
**Replies:** 4\
**Last updated:** [August 1, 2008, 11:34am UTC](https://www.ruby-forum.com/t/improved-find-syntax-in-rails/144702 "2008-08-01T11:34:38Z")

</div>

Hey guys, I was told to move discussion to the mailing list so that is what I am doing. I recently started working with merb and datamapper and I am really fond of moving the super simple conditions syntax over to rai…

---

## [Private equals protected on controllers?](https://www.ruby-forum.com/t/private-equals-protected-on-controllers/144699)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 1\
**Last updated:** [August 1, 2008, 11:03am UTC](https://www.ruby-forum.com/t/private-equals-protected-on-controllers/144699 "2008-08-01T11:03:36Z")

</div>

Hello. It seems private methods of e.g. ApplicationController can be called successfully from other controllers inheriting it. A bug or a “feature”? (Tested with Rails 2.1.0) – A.H.

---

## [Fwd: \[Rails\] routting question](https://www.ruby-forum.com/t/fwd-rails-routting-question/144693)

<div class="topic-metadata">

**Author:** [@tgreiser](https://www.ruby-forum.com/u/tgreiser)\
**Replies:** 1\
**Last updated:** [August 1, 2008, 9:26am UTC](https://www.ruby-forum.com/t/fwd-rails-routting-question/144693 "2008-08-01T09:26:19Z")

</div>

On Thu, Jul 31, 2008 at 6:58 PM, Scott K. \< removed\_email\_address@domain.invalid\> wrote: map.resources :compounds how can i get it to map to http://localhost/compounds/calculator ? map.resources :compunds, :member …

---

## [ActionMailer Not Working After Changing Recipient Email Address](https://www.ruby-forum.com/t/actionmailer-not-working-after-changing-recipient-email-address/144520)

<div class="topic-metadata">

**Author:** [@jeremy](https://www.ruby-forum.com/u/jeremy)\
**Replies:** 1\
**Last updated:** [August 1, 2008, 8:51am UTC](https://www.ruby-forum.com/t/actionmailer-not-working-after-changing-recipient-email-address/144520 "2008-08-01T08:51:12Z")

</div>

Greetings, Well though my crash-course on Rails, I’ve encountered a mystery that is driving my somewhat insane. Our previous web developer wrote a quick form on our site that allowed the user of the site to request a …

---

## [Basic spammer protection w/ nginx?](https://www.ruby-forum.com/t/basic-spammer-protection-w-nginx/144684)

<div class="topic-metadata">

**Author:** [@vince](https://www.ruby-forum.com/u/vince)\
**Replies:** 0\
**Last updated:** [August 1, 2008, 6:07am UTC](https://www.ruby-forum.com/t/basic-spammer-protection-w-nginx/144684 "2008-08-01T06:07:27Z")

</div>

Does anyone have any recommendations for some basic rules I can apply to my nginx.conf file to prevent spambots and the like? I saw a post with some Apache/PHP specific stuff but I’m not sure how to convert it for Ng…

---

## [Routting question](https://www.ruby-forum.com/t/routting-question/144670)

<div class="topic-metadata">

**Author:** [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Replies:** 3\
**Last updated:** [August 1, 2008, 5:31am UTC](https://www.ruby-forum.com/t/routting-question/144670 "2008-08-01T05:31:29Z")

</div>

I have a controller with the default functions index, edit, update…etc but i want to add another route calculator. my current setup: compounds\_controller.rb def index … def calculator … end i also added views/co…

---

## [Link\_to\_remote](https://www.ruby-forum.com/t/link-to-remote/144671)

<div class="topic-metadata">

**Author:** [@bishal](https://www.ruby-forum.com/u/bishal)\
**Replies:** 4\
**Last updated:** [August 1, 2008, 3:35am UTC](https://www.ruby-forum.com/t/link-to-remote/144671 "2008-08-01T03:35:20Z")

</div>

Link\_to\_remote problems… The above ajax call is not working for me. whenever i make a call to the same server using this command i am able to get the response, but when i try to make a similar call to a different uri …

---

## [Rails 2.1.0 caching on development](https://www.ruby-forum.com/t/rails-2-1-0-caching-on-development/144652)

<div class="topic-metadata">

**Author:** [@Eric\_LIn](https://www.ruby-forum.com/u/Eric_LIn)\
**Replies:** 1\
**Last updated:** [August 1, 2008, 2:59am UTC](https://www.ruby-forum.com/t/rails-2-1-0-caching-on-development/144652 "2008-08-01T02:59:12Z")

</div>

Since upgrading to Rails 2.1.0 I’ve noticed my views are being cached in the development environment, which is quite annoying. In my environments/development.rb, I’ve removed the line: config.action\_view.cache\_templat…

---

## [Render a url?](https://www.ruby-forum.com/t/render-a-url/144662)

<div class="topic-metadata">

**Author:** [@jturney](https://www.ruby-forum.com/u/jturney)\
**Replies:** 4\
**Last updated:** [August 1, 2008, 12:28am UTC](https://www.ruby-forum.com/t/render-a-url/144662 "2008-08-01T00:28:07Z")

</div>

uri = session\[:original\_uri\] session\[:original\_uri\] = nil render (uri || { :action =\> :index }) is it possible? Thanks!

---

## [Mongrel and webrick crashing after Fedora update to ruby - 1.8.6.230-1](https://www.ruby-forum.com/t/mongrel-and-webrick-crashing-after-fedora-update-to-ruby-1-8-6-230-1/141411)

<div class="topic-metadata">

**Author:** [@tonypm](https://www.ruby-forum.com/u/tonypm)\
**Replies:** 8\
**Last updated:** [July 31, 2008, 11:57pm UTC](https://www.ruby-forum.com/t/mongrel-and-webrick-crashing-after-fedora-update-to-ruby-1-8-6-230-1/141411 "2008-07-31T23:57:22Z")

</div>

Hi, Fedora updates have just been added to bring Ruby up to version 1.8.6.230-1 . And now both mongrel and webrick crash as soon as a request is received. In both rails 2.0.2 and 2.1.0. Just wondering if anyone els…

---

## [Web-Server for RubyOnRails in Development period](https://www.ruby-forum.com/t/web-server-for-rubyonrails-in-development-period/144629)

<div class="topic-metadata">

**Author:** [@avanetix](https://www.ruby-forum.com/u/avanetix)\
**Replies:** 9\
**Last updated:** [July 31, 2008, 11:29pm UTC](https://www.ruby-forum.com/t/web-server-for-rubyonrails-in-development-period/144629 "2008-07-31T23:29:16Z")

</div>

Hello! What web-server(s) is best for development (not for production) via rubyonrails? I try use Apache + FastCGI, but I must restart Apache to see changes in required ruby-scripts (rb-files). P.S. I want have maxi…

---

## [Sequence of migration execution in 2.1](https://www.ruby-forum.com/t/sequence-of-migration-execution-in-2-1/144568)

<div class="topic-metadata">

**Author:** [@plambert](https://www.ruby-forum.com/u/plambert)\
**Replies:** 2\
**Last updated:** [July 31, 2008, 11:28pm UTC](https://www.ruby-forum.com/t/sequence-of-migration-execution-in-2-1/144568 "2008-07-31T23:28:41Z")

</div>

Our project is currently running Rails 2.0, and I am concerned about the use of timestamps in migration file names in Rails 2.1. We use migrations a lot, for both table structure changes and application data changes,…

---

## [VPS: Rails service not available](https://www.ruby-forum.com/t/vps-rails-service-not-available/144615)

<div class="topic-metadata">

**Author:** [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Replies:** 5\
**Last updated:** [July 31, 2008, 11:22pm UTC](https://www.ruby-forum.com/t/vps-rails-service-not-available/144615 "2008-07-31T23:22:52Z")

</div>

Hi, Im running ruby on rails on A debian VPS package. I have installed ruby / rails all fine. I am now having a problem running my project and serving it out to the www. I have created a project called “test” in : /…

---

## [Sql](https://www.ruby-forum.com/t/sql/144639)

<div class="topic-metadata">

**Author:** [@jturney](https://www.ruby-forum.com/u/jturney)\
**Replies:** 7\
**Last updated:** [July 31, 2008, 11:22pm UTC](https://www.ruby-forum.com/t/sql/144639 "2008-07-31T23:22:48Z")

</div>

Hi, wondering if someone could help me out with an SQL query. I need to select the most recent row in every group (grouped by group#) group#/name/date(rail’s timestamp) 1/bob/2008-07-30 16:00:43 UTC 2/joe/2008-07-30 …

---

## [Rails session ID changing between requests](https://www.ruby-forum.com/t/rails-session-id-changing-between-requests/144448)

<div class="topic-metadata">

**Author:** [@jamie](https://www.ruby-forum.com/u/jamie)\
**Replies:** 5\
**Last updated:** [July 31, 2008, 10:42pm UTC](https://www.ruby-forum.com/t/rails-session-id-changing-between-requests/144448 "2008-07-31T22:42:22Z")

</div>

Looking for insight on a strange problem that I cannot reproduce, but some of my users are experiencing. Every request sent to the browser is assigned a different session id, consequently they cannot log in. The prob…

---

## [Passing variable](https://www.ruby-forum.com/t/passing-variable/144658)

<div class="topic-metadata">

**Author:** [@jturney](https://www.ruby-forum.com/u/jturney)\
**Replies:** 1\
**Last updated:** [July 31, 2008, 9:58pm UTC](https://www.ruby-forum.com/t/passing-variable/144658 "2008-07-31T21:58:27Z")

</div>

def view\_history @posts = Post.search\_by\_requirement\_id(params\[:id\], params\[:page\]) end view\_history.html.erb \<%= render :partial =\> :threads, :collection =\> @posts %\> The @posts in view\_history doesn’t seem to mak…

---

## [Functional tests don't detect that locals are not passed](https://www.ruby-forum.com/t/functional-tests-dont-detect-that-locals-are-not-passed/144657)

<div class="topic-metadata">

**Author:** [@Mats](https://www.ruby-forum.com/u/Mats)\
**Replies:** 1\
**Last updated:** [July 31, 2008, 9:42pm UTC](https://www.ruby-forum.com/t/functional-tests-dont-detect-that-locals-are-not-passed/144657 "2008-07-31T21:42:01Z")

</div>

I have quite a strange problem: there was a bug in my code where I forgot to pass a local variable to a partial. This problem was not detected by my functional tests although it lead to a ActionView::TemplateError: un…

---

## [Help with sorting results](https://www.ruby-forum.com/t/help-with-sorting-results/144581)

<div class="topic-metadata">

**Author:** [@tinney](https://www.ruby-forum.com/u/tinney)\
**Replies:** 2\
**Last updated:** [July 31, 2008, 9:03pm UTC](https://www.ruby-forum.com/t/help-with-sorting-results/144581 "2008-07-31T21:03:22Z")

</div>

Greetings, I’m programming a section of my application that will store and list stories. These stories should be sorted by three factors: genre, order\_by (such as time posted), and sort (ascending or descending). I w…

---

## [Changing url](https://www.ruby-forum.com/t/changing-url/144643)

<div class="topic-metadata">

**Author:** [@jturney](https://www.ruby-forum.com/u/jturney)\
**Replies:** 2\
**Last updated:** [July 31, 2008, 8:54pm UTC](https://www.ruby-forum.com/t/changing-url/144643 "2008-07-31T20:54:54Z")

</div>

I have an ajax form. When it doesn’t get saved, I just params\[:not\_saved\] = true render :action =\> :index view: \<% if params\[:not\_saved\] %\> //show the form \<% end %\> On the form, I have a link\_to\_remote “Cancel” t…

---

## [Use an array in a controller to populate a select box](https://www.ruby-forum.com/t/use-an-array-in-a-controller-to-populate-a-select-box/144590)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 7\
**Last updated:** [July 31, 2008, 7:37pm UTC](https://www.ruby-forum.com/t/use-an-array-in-a-controller-to-populate-a-select-box/144590 "2008-07-31T19:37:51Z")

</div>

I saw a post for a select tag, in the options\_for\_select(\[\[“value 1”, “1”\], \[“value 2”, “2”\], “3”, “4”\],\[“1”, “3”\]) works fine. If I do @test\_select = \[\[“value 1”, “1”\],\[“value 2”, “2”\], “3”, “4”\], \[“1”, “3”\] in the c…

---

## [Alphanumeric Sort](https://www.ruby-forum.com/t/alphanumeric-sort/144645)

<div class="topic-metadata">

**Author:** [@tgreiser](https://www.ruby-forum.com/u/tgreiser)\
**Replies:** 0\
**Last updated:** [July 31, 2008, 7:10pm UTC](https://www.ruby-forum.com/t/alphanumeric-sort/144645 "2008-07-31T19:10:20Z")

</div>

On Thu, Jul 31, 2008 at 10:47 AM, Robert W. removed\_email\_address@domain.invalidwrote: I’d say no, this sort of thing would not be useful (recommended) in core. String based sorting is what it is (and is also affecte…

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

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