# Rails

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

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

---

## [How to does validates\_uniqueness with option :unless work?](https://www.ruby-forum.com/t/how-to-does-validates-uniqueness-with-option-unless-work/134922)

<div class="topic-metadata">

**Author:** [@fries88](https://www.ruby-forum.com/u/fries88)\
**Replies:** 4\
**Last updated:** [April 17, 2008, 11:54am UTC](https://www.ruby-forum.com/t/how-to-does-validates-uniqueness-with-option-unless-work/134922 "2008-04-17T11:54:17Z")

</div>

Hi, I am quite confuse with validates\_uniqueness with option :unless. Correct me if I’m wrong, the :unless =\> :method option enables validation to happen to all except that particular method. But when I used the unle…

---

## [Form\_tag and a very simple form](https://www.ruby-forum.com/t/form-tag-and-a-very-simple-form/135026)

<div class="topic-metadata">

**Author:** [@vanderkerkoff](https://www.ruby-forum.com/u/vanderkerkoff)\
**Replies:** 9\
**Last updated:** [April 17, 2008, 11:44am UTC](https://www.ruby-forum.com/t/form-tag-and-a-very-simple-form/135026 "2008-04-17T11:44:23Z")

</div>

Hello all I’m building a form that is not based on a model. The action I want to happen when I click submit is defined in my controller. Here’s the form code in the html.erb \<% form\_tag ‘/gevents/dotheformstuff/’ do…

---

## [Image button coordinates not in form params](https://www.ruby-forum.com/t/image-button-coordinates-not-in-form-params/135033)

<div class="topic-metadata">

**Author:** [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Replies:** 0\
**Last updated:** [April 17, 2008, 11:15am UTC](https://www.ruby-forum.com/t/image-button-coordinates-not-in-form-params/135033 "2008-04-17T11:15:51Z")

</div>

I have a form submitted using remote\_form\_tag. I have two image buttons in this form. I am accustomed in other languaes of detecting the presence or value of buttonNameA.x and buttonNameB.x to know which button was cl…

---

## [Java private variables in Ruby](https://www.ruby-forum.com/t/java-private-variables-in-ruby/134971)

<div class="topic-metadata">

**Author:** [@jlesleyball](https://www.ruby-forum.com/u/jlesleyball)\
**Replies:** 6\
**Last updated:** [April 17, 2008, 9:33am UTC](https://www.ruby-forum.com/t/java-private-variables-in-ruby/134971 "2008-04-17T09:33:04Z")

</div>

Hi How would I achieve in Ruby what the following line does in Java?: private BufferedImage buf; I need a new BufferedImage, but I don’t want to initialize it yet. Thanks. Jennifer

---

## [Include ActionController::Routing](https://www.ruby-forum.com/t/include-actioncontroller-routing/135000)

<div class="topic-metadata">

**Author:** [@dave](https://www.ruby-forum.com/u/dave)\
**Replies:** 1\
**Last updated:** [April 17, 2008, 9:31am UTC](https://www.ruby-forum.com/t/include-actioncontroller-routing/135000 "2008-04-17T09:31:08Z")

</div>

Hi there, I was wondering how I would gain access to all the named routes available to an application from within a rake task. I tried to “include ActionController::Routing” within the rake task, but that doesn’t see…

---

## [How to dynamically set table\_name of model object without concurrency issues?](https://www.ruby-forum.com/t/how-to-dynamically-set-table-name-of-model-object-without-concurrency-issues/135008)

<div class="topic-metadata">

**Author:** [@FrikShun](https://www.ruby-forum.com/u/FrikShun)\
**Replies:** 1\
**Last updated:** [April 17, 2008, 9:20am UTC](https://www.ruby-forum.com/t/how-to-dynamically-set-table-name-of-model-object-without-concurrency-issues/135008 "2008-04-17T09:20:27Z")

</div>

Hello all, I’m trying to figure out a good way to dynamically set the table\_name of an ActiveRecord model object. I’ve got a legacy db with multiple tables which hold the same type of data. The tables are laid out a…

---

## [Rhtml files and routes](https://www.ruby-forum.com/t/rhtml-files-and-routes/134940)

<div class="topic-metadata">

**Author:** [@ratnavel](https://www.ruby-forum.com/u/ratnavel)\
**Replies:** 2\
**Last updated:** [April 17, 2008, 8:53am UTC](https://www.ruby-forum.com/t/rhtml-files-and-routes/134940 "2008-04-17T08:53:06Z")

</div>

Hi, I have added a applet tag in my rhtml file like and placed that HelloWorld.class in the project root folder but am still getting a error ActionController::RoutingError (No route matches “/HelloWorld.class” …

---

## [Form\_remote\_tag spewing JS error](https://www.ruby-forum.com/t/form-remote-tag-spewing-js-error/135021)

<div class="topic-metadata">

**Author:** [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Replies:** 1\
**Last updated:** [April 17, 2008, 8:45am UTC](https://www.ruby-forum.com/t/form-remote-tag-spewing-js-error/135021 "2008-04-17T08:45:18Z")

</div>

I have a page with a search form using a form\_remote\_for where I want the search results to display below the form. Everything is mostly working, but instead of getting fomatted output, I get a JS error message. That …

---

## [R-o-R projects and Google Website Optimizer](https://www.ruby-forum.com/t/r-o-r-projects-and-google-website-optimizer/135019)

<div class="topic-metadata">

**Author:** [@nahabed](https://www.ruby-forum.com/u/nahabed)\
**Replies:** 0\
**Last updated:** [April 17, 2008, 8:26am UTC](https://www.ruby-forum.com/t/r-o-r-projects-and-google-website-optimizer/135019 "2008-04-17T08:26:45Z")

</div>

We’re building a site with R-o-R and would like to use GWO for optimizing conversions. Anyone here use GWO with Rails? What are some things to do at the implementation level to get “ready” for GWO? How do people use …

---

## [Ruby on Rails Affiliates Program?](https://www.ruby-forum.com/t/ruby-on-rails-affiliates-program/135017)

<div class="topic-metadata">

**Author:** [@lpdahito](https://www.ruby-forum.com/u/lpdahito)\
**Replies:** 0\
**Last updated:** [April 17, 2008, 8:11am UTC](https://www.ruby-forum.com/t/ruby-on-rails-affiliates-program/135017 "2008-04-17T08:11:29Z")

</div>

Hey guys… I’d like to know if there’s an Affiliates Program written in Ruby/ Rails ??? If so, please tell me about it… Thx

---

## [Undefined method \`gem' for main:Object after rake rails:freeze:gems](https://www.ruby-forum.com/t/undefined-method-gem-for-main-object-after-rake-railsgems/130587)

<div class="topic-metadata">

**Author:** [@dale](https://www.ruby-forum.com/u/dale)\
**Replies:** 5\
**Last updated:** [April 17, 2008, 6:07am UTC](https://www.ruby-forum.com/t/undefined-method-gem-for-main-object-after-rake-railsgems/130587 "2008-04-17T06:07:24Z")

</div>

Help! I’m kinda stuck…I’m pretty sure that I somehow need to ‘freeze’ RubyGem itself (aka gem) although given the error below, I’m not sure. I can’t downgrade & freeze to the rails version on the host since my app dep…

---

## [Help with auto\_complete](https://www.ruby-forum.com/t/help-with-auto-complete/134728)

<div class="topic-metadata">

**Author:** [@dhaval\_parikh33](https://www.ruby-forum.com/u/dhaval_parikh33)\
**Replies:** 14\
**Last updated:** [April 17, 2008, 6:01am UTC](https://www.ruby-forum.com/t/help-with-auto-complete/134728 "2008-04-17T06:01:16Z")

</div>

hi, i’ve 2 tables as locations and customers. they have “has\_many” rel’ship.(1 loc has many custs). i’d gone thru http://trix.pl/blog/ruby-on-rails/auto-complete-for-rails-2-0-tutorial this tutorial that worked fine.…

---

## [Ruby Hero Awards](https://www.ruby-forum.com/t/ruby-hero-awards/135014)

<div class="topic-metadata">

**Author:** [@patched](https://www.ruby-forum.com/u/patched)\
**Replies:** 0\
**Last updated:** [April 17, 2008, 6:00am UTC](https://www.ruby-forum.com/t/ruby-hero-awards/135014 "2008-04-17T06:00:24Z")

</div>

Hey guys, Some of you may have already heard about this, but I thought I'd post it to the list since there are quite a few people here who probably deserve some recognition and gratitude. This morning we put up the R…

---

## [Design modeling question](https://www.ruby-forum.com/t/design-modeling-question/134988)

<div class="topic-metadata">

**Author:** [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Replies:** 2\
**Last updated:** [April 17, 2008, 5:37am UTC](https://www.ruby-forum.com/t/design-modeling-question/134988 "2008-04-17T05:37:36Z")

</div>

controllers ManufacturersController ProductsController ClassifiedsController UsersController models (parent models) Manufacuturer has\_one Logo Product has\_one product\_picture Classified has\_many classified\_photos …

---

## [Doing a radius/location search](https://www.ruby-forum.com/t/doing-a-radius-location-search/134991)

<div class="topic-metadata">

**Author:** [@wemagor](https://www.ruby-forum.com/u/wemagor)\
**Replies:** 4\
**Last updated:** [April 17, 2008, 5:33am UTC](https://www.ruby-forum.com/t/doing-a-radius-location-search/134991 "2008-04-17T05:33:31Z")

</div>

The application I’m developing allows people to create events in their local area; as part of this feature I want to display a list of, say, the five most recent events within 30 miles of a person’s location. I have …

---

## [Render arguments :locals and :layout only available on partials?](https://www.ruby-forum.com/t/render-arguments-locals-and-layout-only-available-on-partials/134986)

<div class="topic-metadata">

**Author:** [@Pito](https://www.ruby-forum.com/u/Pito)\
**Replies:** 1\
**Last updated:** [April 17, 2008, 5:14am UTC](https://www.ruby-forum.com/t/render-arguments-locals-and-layout-only-available-on-partials/134986 "2008-04-17T05:14:49Z")

</div>

It looks to me like the :locals and :layout arguments for the render call don’t do anything unless you are rendering a :partial. Is that right or am I misdiagnosing what’s happening to me?

---

## [Question about yaml. Thank you!](https://www.ruby-forum.com/t/question-about-yaml-thank-you/134974)

<div class="topic-metadata">

**Author:** [@beexk](https://www.ruby-forum.com/u/beexk)\
**Replies:** 2\
**Last updated:** [April 17, 2008, 5:04am UTC](https://www.ruby-forum.com/t/question-about-yaml-thank-you/134974 "2008-04-17T05:04:56Z")

</div>

Hi friends: I tried to convert a model object to yaml(use to\_yaml method), and after that, I would like to convert the yaml(string type) back to the model object. But when I use YAML::load to do that, it failed, the r…

---

## [MySQL gem segfault](https://www.ruby-forum.com/t/mysql-gem-segfault/134962)

<div class="topic-metadata">

**Author:** [@Glen](https://www.ruby-forum.com/u/Glen)\
**Replies:** 3\
**Last updated:** [April 17, 2008, 2:39am UTC](https://www.ruby-forum.com/t/mysql-gem-segfault/134962 "2008-04-17T02:39:13Z")

</div>

I’m encountering odd behavior. I’m not quite sure where to post this so I will try the rails list first. Here is the scenario: I have MySQL 5.0.51 installed on a Windows 2003 Server machine. I have Rails 2.0.2 and R…

---

## [Undefined method exception if no data is present](https://www.ruby-forum.com/t/undefined-method-exception-if-no-data-is-present/135007)

<div class="topic-metadata">

**Author:** [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Replies:** 2\
**Last updated:** [April 17, 2008, 2:17am UTC](https://www.ruby-forum.com/t/undefined-method-exception-if-no-data-is-present/135007 "2008-04-17T02:17:28Z")

</div>

I get this error if no relational data is present: undefined method \`notes’ for #Array:0x226cc4c Here is the code that causes the error: @notes = @account.notes If I call this method through the script/console I get …

---

## [Can't convert nil to string error: how to solve?](https://www.ruby-forum.com/t/cant-convert-nil-to-string-error-how-to-solve/135001)

<div class="topic-metadata">

**Author:** [@jlesleyball](https://www.ruby-forum.com/u/jlesleyball)\
**Replies:** 2\
**Last updated:** [April 17, 2008, 12:48am UTC](https://www.ruby-forum.com/t/cant-convert-nil-to-string-error-how-to-solve/135001 "2008-04-17T00:48:42Z")

</div>

Hi What would you say are the top reasons for getting this error? I don’t seem to have any of the example cases I’ve found searching with Google, and trying to trace through the stack is not giving me any clues. An…

---

## [Will acts\_as\_taggable\_on\_steroids and better\_nested\_set work together?](https://www.ruby-forum.com/t/will-acts-as-taggable-on-steroids-and-better-nested-set-work-together/134957)

<div class="topic-metadata">

**Author:** [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Replies:** 8\
**Last updated:** [April 16, 2008, 11:26pm UTC](https://www.ruby-forum.com/t/will-acts-as-taggable-on-steroids-and-better-nested-set-work-together/134957 "2008-04-16T23:26:04Z")

</div>

I am having this crazy problem where it ONLY shows up in testing. This is my test code def test\_should\_destroy task1 = Task.new(:description =\> “tmp”, :done =\> false, :user =\> User.find\_by\_login(‘admin’)) assert …

---

## [Problem rendering within a table](https://www.ruby-forum.com/t/problem-rendering-within-a-table/134967)

<div class="topic-metadata">

**Author:** [@pimeamark](https://www.ruby-forum.com/u/pimeamark)\
**Replies:** 6\
**Last updated:** [April 16, 2008, 11:15pm UTC](https://www.ruby-forum.com/t/problem-rendering-within-a-table/134967 "2008-04-16T23:15:34Z")

</div>

Hi, I seem to be having an issue with rendering a partial within a table. Basically, I had a partial with all my and tags that was to be rendered inside the tags on my page. When it rendered, all the tags were rem…

---

## [ACL System restrict\_to](https://www.ruby-forum.com/t/acl-system-restrict-to/117656)

<div class="topic-metadata">

**Author:** [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Replies:** 1\
**Last updated:** [April 16, 2008, 11:06pm UTC](https://www.ruby-forum.com/t/acl-system-restrict-to/117656 "2008-04-16T23:06:01Z")

</div>

Does the restrict\_to method only work in the views for some reason? I have tried it in the controller and i get the “undefined local variable or method \`restrict\_to’ for Admin::SurveysController:Class” Ive even copie…

---

## [Firendship representation in rails](https://www.ruby-forum.com/t/firendship-representation-in-rails/134855)

<div class="topic-metadata">

**Author:** [@gadys](https://www.ruby-forum.com/u/gadys)\
**Replies:** 4\
**Last updated:** [April 16, 2008, 11:03pm UTC](https://www.ruby-forum.com/t/firendship-representation-in-rails/134855 "2008-04-16T23:03:25Z")

</div>

Hi I want to represent a social graph in my facebooker application. I have a class user and I want to connect each user to his friends using many-to-many. I am planning to support other networks in the future so I ha…

---

## [Ignoring errors](https://www.ruby-forum.com/t/ignoring-errors/134995)

<div class="topic-metadata">

**Author:** [@cumom](https://www.ruby-forum.com/u/cumom)\
**Replies:** 2\
**Last updated:** [April 16, 2008, 10:57pm UTC](https://www.ruby-forum.com/t/ignoring-errors/134995 "2008-04-16T22:57:42Z")

</div>

I am getting a mysql duplicate entry error. Can I ignore the error (let the script continue), and how would I do that? Or should I check if the entry exists every time, before I try to add it?

---

## [ActiveRecord methods to work with indexes?](https://www.ruby-forum.com/t/activerecord-methods-to-work-with-indexes/134990)

<div class="topic-metadata">

**Author:** [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Replies:** 4\
**Last updated:** [April 16, 2008, 10:55pm UTC](https://www.ruby-forum.com/t/activerecord-methods-to-work-with-indexes/134990 "2008-04-16T22:55:56Z")

</div>

Do ActiveRecord have any functions to work with indexes. For example, say I had class Book \< ActiveRecord::Base end Book.indexes =\> \[“idx\_on\_creator\_id”, “idx\_on\_somethingelse”\] Book.index\_on(“creator\_id”) =\> “idx\_o…

---

## [Can I use conditions outside of find(...)?](https://www.ruby-forum.com/t/can-i-use-conditions-outside-of-find/134978)

<div class="topic-metadata">

**Author:** [@kuma](https://www.ruby-forum.com/u/kuma)\
**Replies:** 6\
**Last updated:** [April 16, 2008, 10:13pm UTC](https://www.ruby-forum.com/t/can-i-use-conditions-outside-of-find/134978 "2008-04-16T22:13:09Z")

</div>

Hi all, Many apps duplicate logic in SQL and in model methods. This isn’t very DRY. Can I factor out the conditions somehow, and leverage them in both places, e.g.: class Order PRIORITY\_CONDITIONS = “(status = 2 A…

---

## [New mime type. Works in windows, fails in ubuntu](https://www.ruby-forum.com/t/new-mime-type-works-in-windows-fails-in-ubuntu/134951)

<div class="topic-metadata">

**Author:** [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Replies:** 2\
**Last updated:** [April 16, 2008, 10:07pm UTC](https://www.ruby-forum.com/t/new-mime-type-works-in-windows-fails-in-ubuntu/134951 "2008-04-16T22:07:36Z")

</div>

Hi, I am generating some SVG content from my app. To get that working I’ve done the next: Add line in /config/initializers/mime\_types.rb$: Mime::Type.register “application/xhtml+xml”, :svg In my controller I have no…

---

## [Complex Forms](https://www.ruby-forum.com/t/complex-forms/134972)

<div class="topic-metadata">

**Author:** [@rooster](https://www.ruby-forum.com/u/rooster)\
**Replies:** 5\
**Last updated:** [April 16, 2008, 9:31pm UTC](https://www.ruby-forum.com/t/complex-forms/134972 "2008-04-16T21:31:12Z")

</div>

Im trying to follow the railscasts complex forms tutorial, but im doing it with :through realted tables and im having some problems. Ive made a pastie of the error and related files so its easier to read: Parked at Lo…

---

## [Has\_many :through & \<\< & STI](https://www.ruby-forum.com/t/has-many-through-sti/134989)

<div class="topic-metadata">

**Author:** [@BJ\_ClarkSthe\_scie](https://www.ruby-forum.com/u/BJ_ClarkSthe_scie)\
**Replies:** 0\
**Last updated:** [April 16, 2008, 9:30pm UTC](https://www.ruby-forum.com/t/has-many-through-sti/134989 "2008-04-16T21:30:31Z")

</div>

I’ve got a pretty crazy has\_many :through going. My join table is set up like this: Table name: memberships id :integer not null, primary key member\_of\_id :integer member\_of\_type :string(255) use…

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

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