# Rails

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

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

---

## [ON DUPLICATE KEY update counter](https://www.ruby-forum.com/t/on-duplicate-key-update-counter/127507)

<div class="topic-metadata">

**Author:** [@jackster](https://www.ruby-forum.com/u/jackster)\
**Replies:** 0\
**Last updated:** [January 29, 2008, 10:27pm UTC](https://www.ruby-forum.com/t/on-duplicate-key-update-counter/127507 "2008-01-29T22:27:23Z")

</div>

When my DB insert into MySQL is denied due to a unique field that is already populated, I want to update the field called “counter” for that record so I know how many times a duplicate record tried to perform the inse…

---

## [TSOT Ruby on Rails Project Night Returns Feb. 12th](https://www.ruby-forum.com/t/tsot-ruby-on-rails-project-night-returns-feb-12th/127506)

<div class="topic-metadata">

**Author:** [@Corina](https://www.ruby-forum.com/u/Corina)\
**Replies:** 0\
**Last updated:** [January 29, 2008, 10:26pm UTC](https://www.ruby-forum.com/t/tsot-ruby-on-rails-project-night-returns-feb-12th/127506 "2008-01-29T22:26:47Z")

</div>

Attention Toronto Tech Community, Tuesday February 12th marks the return of the monthly TSOT Ruby on Rails Project Night, which promises to be another great event for Toronto’s Tech crowd. We had a tremendous response…

---

## [I only want to validate when field is not empty](https://www.ruby-forum.com/t/i-only-want-to-validate-when-field-is-not-empty/127470)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 5\
**Last updated:** [January 29, 2008, 10:16pm UTC](https://www.ruby-forum.com/t/i-only-want-to-validate-when-field-is-not-empty/127470 "2008-01-29T22:16:10Z")

</div>

Hi, I have a field in my user model: Work phone \<%= text\_field 'user', 'work\_phone' %\> But I only want to validate it if it is non-empty. So I put this into my user model: validates\_as\_phone :work\_phone, :…

---

## [Controlling content\_type in attachment\_fu](https://www.ruby-forum.com/t/controlling-content-type-in-attachment-fu/127500)

<div class="topic-metadata">

**Author:** [@rykkers](https://www.ruby-forum.com/u/rykkers)\
**Replies:** 0\
**Last updated:** [January 29, 2008, 9:28pm UTC](https://www.ruby-forum.com/t/controlling-content-type-in-attachment-fu/127500 "2008-01-29T21:28:03Z")

</div>

I’m working on an app where a model can have different kinds of audio attachments, in this case mp3 and m4a files. I want to distiguish between them by content type. So I want mp3 files to have a content type of aud…

---

## [Using ruby Net::HTTP with self signed certificates](https://www.ruby-forum.com/t/using-ruby-net-http-with-self-signed-certificates/127479)

<div class="topic-metadata">

**Author:** [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Replies:** 1\
**Last updated:** [January 29, 2008, 9:25pm UTC](https://www.ruby-forum.com/t/using-ruby-net-http-with-self-signed-certificates/127479 "2008-01-29T21:25:06Z")

</div>

Probably more of a ruby question than a rails question but I am trying to retrieve a file from my web server that requires ssl but uses a self signed certificate. Looking through all of the documentation at http://ww…

---

## [Rake test return value](https://www.ruby-forum.com/t/rake-test-return-value/127418)

<div class="topic-metadata">

**Author:** [@rehevkor5](https://www.ruby-forum.com/u/rehevkor5)\
**Replies:** 4\
**Last updated:** [January 29, 2008, 9:00pm UTC](https://www.ruby-forum.com/t/rake-test-return-value/127418 "2008-01-29T21:00:16Z")

</div>

I need to run tests nightly on Rails apps, with automated reporting when the tests fail so that someone can address the issue. However AFAIK rake always returns 0 even if tests failed. Am I missing something? I’d lik…

---

## [Use Rails to upload with net::ftp instead of html](https://www.ruby-forum.com/t/use-rails-to-upload-with-net-ftp-instead-of-html/127461)

<div class="topic-metadata">

**Author:** [@tripdragon](https://www.ruby-forum.com/u/tripdragon)\
**Replies:** 1\
**Last updated:** [January 29, 2008, 8:56pm UTC](https://www.ruby-forum.com/t/use-rails-to-upload-with-net-ftp-instead-of-html/127461 "2008-01-29T20:56:41Z")

</div>

I have this uploader that was working just fine with html file\_field and File.open But now I have to large of files to send so I am having to resort to other means and can not use attachment\_fu yet So the portion of …

---

## [Submit form without method name?](https://www.ruby-forum.com/t/submit-form-without-method-name/127493)

<div class="topic-metadata">

**Author:** [@vapor](https://www.ruby-forum.com/u/vapor)\
**Replies:** 1\
**Last updated:** [January 29, 2008, 8:00pm UTC](https://www.ruby-forum.com/t/submit-form-without-method-name/127493 "2008-01-29T20:00:59Z")

</div>

I have seen some sites that use something like app.com/controller-name in forms and tell no method…how can i do this?

---

## [Anybody using SuperInPlaceControls?](https://www.ruby-forum.com/t/anybody-using-superinplacecontrols/126204)

<div class="topic-metadata">

**Author:** [@flyingzumwalt](https://www.ruby-forum.com/u/flyingzumwalt)\
**Replies:** 2\
**Last updated:** [January 29, 2008, 7:31pm UTC](https://www.ruby-forum.com/t/anybody-using-superinplacecontrols/126204 "2008-01-29T19:31:02Z")

</div>

Cool plugin but i got stuck. http://os.flvorful.com/super\_in\_place\_controls/demo Everything is fine until I click OK button after I edit a column. It comes up: RJS error: TypeError: $(element) has no properties and …

---

## [Yui with rails](https://www.ruby-forum.com/t/yui-with-rails/127137)

<div class="topic-metadata">

**Author:** [@ankit2584](https://www.ruby-forum.com/u/ankit2584)\
**Replies:** 1\
**Last updated:** [January 29, 2008, 7:20pm UTC](https://www.ruby-forum.com/t/yui-with-rails/127137 "2008-01-29T19:20:23Z")

</div>

Hi, has anyone made a yui tree with real data(datafrom database) in rails. I have sen sonjoya Tondons part for drag and drop tree http://sonjayatandon.com/08-2006/how-to-add-dragdrop-behavior-to-a-yui-tree/ but coul…

---

## [Mysterious Content-Length: 0](https://www.ruby-forum.com/t/mysterious-content-length-0/127485)

<div class="topic-metadata">

**Author:** [@fxn](https://www.ruby-forum.com/u/fxn)\
**Replies:** 1\
**Last updated:** [January 29, 2008, 7:17pm UTC](https://www.ruby-forum.com/t/mysterious-content-length-0/127485 "2008-01-29T19:17:58Z")

</div>

I am lost here. I have a very simple action: # DELETE /bookings/{id} def destroy adapter = adapter\_for(@booking.chain\_id) adapter.cancel(@booking) if @booking.update\_attribute(:cancelled, true) head :no\_conten…

---

## [Weirdness with model.send(string).build](https://www.ruby-forum.com/t/weirdness-with-model-send-string-build/127488)

<div class="topic-metadata">

**Author:** [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Replies:** 0\
**Last updated:** [January 29, 2008, 7:00pm UTC](https://www.ruby-forum.com/t/weirdness-with-model-send-string-build/127488 "2008-01-29T19:00:22Z")

</div>

I’ve got a weird problem which i can work around but want to understand! :slight\_smile: Let’s say that name = “small\_logo” This works - @small\_logo = @music\_service.send(“small\_logo”).build(file\_hash) and this work…

---

## [Javascript popup and form remote tag](https://www.ruby-forum.com/t/javascript-popup-and-form-remote-tag/127486)

<div class="topic-metadata">

**Author:** [@neha-rohan](https://www.ruby-forum.com/u/neha-rohan)\
**Replies:** 0\
**Last updated:** [January 29, 2008, 6:54pm UTC](https://www.ruby-forum.com/t/javascript-popup-and-form-remote-tag/127486 "2008-01-29T18:54:25Z")

</div>

Hi, I have a javascript popup window, in that i have a form\_remote\_tag call. On the completion of this call, i want some server side code to execute and form to be submitted, after that is done i want the pop up windo…

---

## [Cant identify Multiple Submit Buttons in form\_remote\_tag](https://www.ruby-forum.com/t/cant-identify-multiple-submit-buttons-in-form-remote-tag/49579)

<div class="topic-metadata">

**Author:** [@prasad](https://www.ruby-forum.com/u/prasad)\
**Replies:** 1\
**Last updated:** [January 29, 2008, 6:52pm UTC](https://www.ruby-forum.com/t/cant-identify-multiple-submit-buttons-in-form-remote-tag/49579 "2008-01-29T18:52:52Z")

</div>

Hi, Like Derek, I also found a bug in the form\_remote\_tag function. Whenever there are two or more Submit buttons, rails is not able to identify as to which Submit button has been clicked. On the otherhand Non-AJAX f…

---

## [Rails Config/Environment.rb](https://www.ruby-forum.com/t/rails-config-environment-rb/127482)

<div class="topic-metadata">

**Author:** [@pete](https://www.ruby-forum.com/u/pete)\
**Replies:** 0\
**Last updated:** [January 29, 2008, 6:28pm UTC](https://www.ruby-forum.com/t/rails-config-environment-rb/127482 "2008-01-29T18:28:07Z")

</div>

Is the environment.rb file where you would put your ‘require’ statements? Like what I have below? Thanks! … Include your application configuration below require ‘some lib’

---

## [FastCGI and Development Period](https://www.ruby-forum.com/t/fastcgi-and-development-period/127340)

<div class="topic-metadata">

**Author:** [@avanetix](https://www.ruby-forum.com/u/avanetix)\
**Replies:** 3\
**Last updated:** [January 29, 2008, 6:10pm UTC](https://www.ruby-forum.com/t/fastcgi-and-development-period/127340 "2008-01-29T18:10:53Z")

</div>

Hello! RubyOnRails + FastCGI is only for ready project? When I use fastcgi in my project in development period, apache caches all my ruby-classes. And I must restart my web-server to see changes in my ruby-classes. I…

---

## [RESTful routes and subdomains](https://www.ruby-forum.com/t/restful-routes-and-subdomains/127437)

<div class="topic-metadata">

**Author:** [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Replies:** 2\
**Last updated:** [January 29, 2008, 6:05pm UTC](https://www.ruby-forum.com/t/restful-routes-and-subdomains/127437 "2008-01-29T18:05:50Z")

</div>

I am looking for a way to use RESTful routes, but include the ability to add the required subdomain to the url. I have found a couple plugins, but they don’t allow for the RESTful routes. Does anyone know of any? Th…

---

## [A good way to store some profile-information?](https://www.ruby-forum.com/t/a-good-way-to-store-some-profile-information/127466)

<div class="topic-metadata">

**Author:** [@peter](https://www.ruby-forum.com/u/peter)\
**Replies:** 2\
**Last updated:** [January 29, 2008, 5:50pm UTC](https://www.ruby-forum.com/t/a-good-way-to-store-some-profile-information/127466 "2008-01-29T17:50:47Z")

</div>

What would be a good way to store profile-information, in the cases where the information can be selected from a list of choices? i.e. gender (male,female), religion or marital status. The lists don’t change, so putti…

---

## [Can write file via IRB, but not from actual controller...odd](https://www.ruby-forum.com/t/can-write-file-via-irb-but-not-from-actual-controller-odd/127387)

<div class="topic-metadata">

**Author:** [@pyroblue](https://www.ruby-forum.com/u/pyroblue)\
**Replies:** 1\
**Last updated:** [January 29, 2008, 5:49pm UTC](https://www.ruby-forum.com/t/can-write-file-via-irb-but-not-from-actual-controller-odd/127387 "2008-01-29T17:49:01Z")

</div>

i have my rails app hosted at eapps.com (great folks) – but im running into an ODD issue…maybe someone can help. if i go into IRB and type: File.new(“temp.txt”, “w”) , everything goes well, and it creates the file in…

---

## [Has\_many relationships](https://www.ruby-forum.com/t/has-many-relationships/127433)

<div class="topic-metadata">

**Author:** [@obenhauser](https://www.ruby-forum.com/u/obenhauser)\
**Replies:** 3\
**Last updated:** [January 29, 2008, 5:42pm UTC](https://www.ruby-forum.com/t/has-many-relationships/127433 "2008-01-29T17:42:08Z")

</div>

In my model I have two classes, a donation class and a good class. A donation can have mulitple goods, so I set up a has\_many relationship between the two objects. class Donation \< ActiveRecord::Base has\_many :goods …

---

## [Autocomplete layers](https://www.ruby-forum.com/t/autocomplete-layers/127422)

<div class="topic-metadata">

**Author:** [@revanche](https://www.ruby-forum.com/u/revanche)\
**Replies:** 1\
**Last updated:** [January 29, 2008, 5:32pm UTC](https://www.ruby-forum.com/t/autocomplete-layers/127422 "2008-01-29T17:32:21Z")

</div>

Hi everyone, I’m trying to extend the functionality of the autocomplete just a little bit but without understanding exactly what it’s doing, I’m finding it get it where I want. If anyone could lend a hand, it would be …

---

## [Variable variables](https://www.ruby-forum.com/t/variable-variables/126350)

<div class="topic-metadata">

**Author:** [@spokra](https://www.ruby-forum.com/u/spokra)\
**Replies:** 3\
**Last updated:** [January 29, 2008, 5:29pm UTC](https://www.ruby-forum.com/t/variable-variables/126350 "2008-01-29T17:29:52Z")

</div>

I know this can be done… rails creates methods from variables all the time… but how do you code it? say you have two strings. a=“test” test=“this is a test” how do you get the contents of test with the variable a? #…

---

## [Have XML, want JSON](https://www.ruby-forum.com/t/have-xml-want-json/127407)

<div class="topic-metadata">

**Author:** [@gustav](https://www.ruby-forum.com/u/gustav)\
**Replies:** 3\
**Last updated:** [January 29, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/have-xml-want-json/127407 "2008-01-29T17:24:33Z")

</div>

I’m getting an XML-document form a third party URL, parse it using Hpricot and Xpath and wish to return the result as JSON. However, I can’t find a decent way to convert XML to JSON, is there a nice Railsy shortcut fo…

---

## [Caching only certain formats (xml) of an action](https://www.ruby-forum.com/t/caching-only-certain-formats-xml-of-an-action/127403)

<div class="topic-metadata">

**Author:** [@cleaner416](https://www.ruby-forum.com/u/cleaner416)\
**Replies:** 2\
**Last updated:** [January 29, 2008, 5:12pm UTC](https://www.ruby-forum.com/t/caching-only-certain-formats-xml-of-an-action/127403 "2008-01-29T17:12:21Z")

</div>

I’ve got a controller method that I’d like to cache … the problem is I only want to cache the XML output of a method. (This is for a number of reasons, including the fact that the feed of this action gets hit fairly …

---

## [Send rendered page as email](https://www.ruby-forum.com/t/send-rendered-page-as-email/127456)

<div class="topic-metadata">

**Author:** [@pie-r-squared](https://www.ruby-forum.com/u/pie-r-squared)\
**Replies:** 4\
**Last updated:** [January 29, 2008, 5:07pm UTC](https://www.ruby-forum.com/t/send-rendered-page-as-email/127456 "2008-01-29T17:07:29Z")

</div>

I feel like this is actually easy, but I haven’t been able to attack it from the right angle. A client wants “send to a friend” functionality that will allow a user to enter an email address to send the page to, and t…

---

## [Class extensions in lib not loading](https://www.ruby-forum.com/t/class-extensions-in-lib-not-loading/124605)

<div class="topic-metadata">

**Author:** [@Bradley\_M](https://www.ruby-forum.com/u/Bradley_M)\
**Replies:** 2\
**Last updated:** [January 29, 2008, 5:05pm UTC](https://www.ruby-forum.com/t/class-extensions-in-lib-not-loading/124605 "2008-01-29T17:05:44Z")

</div>

Hi, I’m using 2.0.2. If I add a class to ./lib, the class is created and I can access it on script/console. However, if I extend a (core) class using a file in lib, the class extension does not occur. The methods I…

---

## [Find on Element without hitting the database](https://www.ruby-forum.com/t/find-on-element-without-hitting-the-database/127467)

<div class="topic-metadata">

**Author:** [@lundie](https://www.ruby-forum.com/u/lundie)\
**Replies:** 2\
**Last updated:** [January 29, 2008, 5:05pm UTC](https://www.ruby-forum.com/t/find-on-element-without-hitting-the-database/127467 "2008-01-29T17:05:43Z")

</div>

Hi, I have a task model with a one to many relationship with a todo model. If I do a find on the task model: task = Tasks.find(1) Is there a way to search the todos on a particular field without hitting the database…

---

## [Prices and discounts](https://www.ruby-forum.com/t/prices-and-discounts/127462)

<div class="topic-metadata">

**Author:** [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Replies:** 1\
**Last updated:** [January 29, 2008, 5:00pm UTC](https://www.ruby-forum.com/t/prices-and-discounts/127462 "2008-01-29T17:00:04Z")

</div>

I’m trying to solve a problem for a client. It’s a language school. They have, courses so I have a Courses model and table. Each course has a name and a description and a price\_per\_week field (a base price if you lik…

---

## [ActionMailer calling shared methods](https://www.ruby-forum.com/t/actionmailer-calling-shared-methods/225991)

<div class="topic-metadata">

**Author:** [@pkoebbe](https://www.ruby-forum.com/u/pkoebbe)\
**Replies:** 0\
**Last updated:** [January 29, 2008, 4:39pm UTC](https://www.ruby-forum.com/t/actionmailer-calling-shared-methods/225991 "2008-01-29T16:39:03Z")

</div>

I’m trying to use a shared method from an ActionMailer template. The method was originally in ApplicationHelper, but I’ve also tried it in the base controller (application.rb), with and without helper\_method. In all…

---

## [Processing ActiveRecord](https://www.ruby-forum.com/t/processing-activerecord/127458)

<div class="topic-metadata">

**Author:** [@pete](https://www.ruby-forum.com/u/pete)\
**Replies:** 6\
**Last updated:** [January 29, 2008, 4:06pm UTC](https://www.ruby-forum.com/t/processing-activerecord/127458 "2008-01-29T16:06:39Z")

</div>

Hi- What I would like to do in the controller is select 2 rows from my DB and manipulate those rows to be rendered in the view. result = MyModel.find(:all, :limit =\> 2, :select =\> column) # Gives me 2 rows. @view\_st…

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

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