# Rails

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

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

---

## [Has\_many :through, multi model form unable to save new child](https://www.ruby-forum.com/t/has-many-through-multi-model-form-unable-to-save-new-child/173344)

<div class="topic-metadata">

**Author:** [@aftershock](https://www.ruby-forum.com/u/aftershock)\
**Replies:** 6\
**Last updated:** [August 8, 2009, 5:38pm UTC](https://www.ruby-forum.com/t/has-many-through-multi-model-form-unable-to-save-new-child/173344 "2009-08-08T17:38:13Z")

</div>

I am totally unable to create a new child in a has\_many :through multi model form using nested\_attributes for an existing grandparent. Sorry, that sounds quite a mouth full. Basically I am editing an existing user tha…

---

## [Question on the latest rails book](https://www.ruby-forum.com/t/question-on-the-latest-rails-book/173401)

<div class="topic-metadata">

**Author:** [@Paulo\_JSMatos](https://www.ruby-forum.com/u/Paulo_JSMatos)\
**Replies:** 5\
**Last updated:** [August 8, 2009, 4:18pm UTC](https://www.ruby-forum.com/t/question-on-the-latest-rails-book/173401 "2009-08-08T16:18:04Z")

</div>

Hi all, I am learning rails by going through 3rd ed of the Rails book. In page 153, after creating the user scaffold it says: “Since this modified config/routes.rb, which is cached for performance reasons, you will n…

---

## [Start contributing to open source](https://www.ruby-forum.com/t/start-contributing-to-open-source/173422)

<div class="topic-metadata">

**Author:** [@milandobrota](https://www.ruby-forum.com/u/milandobrota)\
**Replies:** 1\
**Last updated:** [August 8, 2009, 1:55pm UTC](https://www.ruby-forum.com/t/start-contributing-to-open-source/173422 "2009-08-08T13:55:37Z")

</div>

I want to start contributing to open source. I aim at ruby, with or without rails. What is the best way to find the right project? Github? Is it better to work on something that has just started with development, or …

---

## [Yaml for jqgrid](https://www.ruby-forum.com/t/yaml-for-jqgrid/173386)

<div class="topic-metadata">

**Author:** [@iamdonquixote](https://www.ruby-forum.com/u/iamdonquixote)\
**Replies:** 1\
**Last updated:** [August 8, 2009, 11:53am UTC](https://www.ruby-forum.com/t/yaml-for-jqgrid/173386 "2009-08-08T11:53:18Z")

</div>

Anyone have a more extensive yaml file for jqgrid than the one that’s shown with the example Jqgrid Demos page? Also, I’ve been successful in just using the straight jQuery javascript code, rather than invoking the ya…

---

## ["gem install mysql" fails](https://www.ruby-forum.com/t/gem-install-mysql-fails/164876)

<div class="topic-metadata">

**Author:** [@sporkit](https://www.ruby-forum.com/u/sporkit)\
**Replies:** 10\
**Last updated:** [August 8, 2009, 11:44am UTC](https://www.ruby-forum.com/t/gem-install-mysql-fails/164876 "2009-08-08T11:44:05Z")

</div>

To sum this up, gem install mysql crashes when looking for version.h. This is happening after a fresh install of Ruby, Ruby Gems, and the Mysql gem. Shouldn’t a fresh install of ruby create version.h and place it in …

---

## [Doubt retrieving data?](https://www.ruby-forum.com/t/doubt-retrieving-data/173415)

<div class="topic-metadata">

**Author:** [@karthik](https://www.ruby-forum.com/u/karthik)\
**Replies:** 2\
**Last updated:** [August 8, 2009, 10:44am UTC](https://www.ruby-forum.com/t/doubt-retrieving-data/173415 "2009-08-08T10:44:13Z")

</div>

hi my controller has def searchwithstatus @agency=params\[:agency\]\[:agency\_id\] @contract=params\[:agency\]\[:contracts\_id\] @agencies=Agency.find(:all,:conditions=\>{:deleted=\>1,:contract\_id=\>@contract,:state\_id=\>@state}) …

---

## [Scaffolding in a sub-directory on Rails 2.x](https://www.ruby-forum.com/t/scaffolding-in-a-sub-directory-on-rails-2-x/173358)

<div class="topic-metadata">

**Author:** [@chrisnzi](https://www.ruby-forum.com/u/chrisnzi)\
**Replies:** 4\
**Last updated:** [August 8, 2009, 8:57am UTC](https://www.ruby-forum.com/t/scaffolding-in-a-sub-directory-on-rails-2-x/173358 "2009-08-08T08:57:59Z")

</div>

Hi, I’m trying to make an app using rails 2.x, but when I try to generate scaffold it messes up with several errors. For example, I want to make an scaffold this way, localhost:3000/admin/publisher, but I don’t know …

---

## [Does anyone know where can I get US zip codes with time zones?](https://www.ruby-forum.com/t/does-anyone-know-where-can-i-get-us-zip-codes-with-time-zones/172651)

<div class="topic-metadata">

**Author:** [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Replies:** 4\
**Last updated:** [August 8, 2009, 7:31am UTC](https://www.ruby-forum.com/t/does-anyone-know-where-can-i-get-us-zip-codes-with-time-zones/172651 "2009-08-08T07:31:38Z")

</div>

Hi, we ask user for his zip code and currently we also ask for this time zone (only US). It’s a bit redundant, so I’d like to figure out user’s time zone based on his zip code. The problem is that all services I’ve s…

---

## [Why associations get error when defined in abstract\_class model](https://www.ruby-forum.com/t/why-associations-get-error-when-defined-in-abstract-class-model/173411)

<div class="topic-metadata">

**Author:** [@boblu](https://www.ruby-forum.com/u/boblu)\
**Replies:** 1\
**Last updated:** [August 8, 2009, 6:24am UTC](https://www.ruby-forum.com/t/why-associations-get-error-when-defined-in-abstract-class-model/173411 "2009-08-08T06:24:53Z")

</div>

I have many models and want to share common functions among them in abstract\_class models as many as possible. But why the associations specified in abstract\_class do not work? For example: class Property \< AR::Base …

---

## [ActiveResource and inheritance](https://www.ruby-forum.com/t/activeresource-and-inheritance/173407)

<div class="topic-metadata">

**Author:** [@slavix](https://www.ruby-forum.com/u/slavix)\
**Replies:** 0\
**Last updated:** [August 8, 2009, 3:49am UTC](https://www.ruby-forum.com/t/activeresource-and-inheritance/173407 "2009-08-08T03:49:45Z")

</div>

Quotation \< Document \< ActiveResource doc = Document.find(id) GET http://someurl/documents/.xml … doc.class # =\> Document instantiates Document even when the record is a Quotation How do get the doc to be insta…

---

## [How to specify ActiveRecord's to\_json encoding](https://www.ruby-forum.com/t/how-to-specify-activerecords-to-json-encoding/173400)

<div class="topic-metadata">

**Author:** [@rubynewbie](https://www.ruby-forum.com/u/rubynewbie)\
**Replies:** 0\
**Last updated:** [August 8, 2009, 1:12am UTC](https://www.ruby-forum.com/t/how-to-specify-activerecords-to-json-encoding/173400 "2009-08-08T01:12:52Z")

</div>

Question: Hi, our company is using Ruby 1.8.6 with Rails 2.2.2. Does anyone know we can explicitly specify what encoding to use when calling to\_json() or to\_xml() methods? Problem: We have some multibyte characters…

---

## [Email templates not updating](https://www.ruby-forum.com/t/email-templates-not-updating/173399)

<div class="topic-metadata">

**Author:** [@mdeering](https://www.ruby-forum.com/u/mdeering)\
**Replies:** 1\
**Last updated:** [August 8, 2009, 1:06am UTC](https://www.ruby-forum.com/t/email-templates-not-updating/173399 "2009-08-08T01:06:29Z")

</div>

I have a strange problem: I am using ActionMailer via ar\_mailer to mail out some multi-part email with templates and it’s working just fine. But, if I make a change to the templates, new email generated uses the old t…

---

## [Polymorphic belongs\_to with :class\_name =\> abstract class](https://www.ruby-forum.com/t/polymorphic-belongs-to-with-class-name-abstract-class/173385)

<div class="topic-metadata">

**Author:** [@fritza](https://www.ruby-forum.com/u/fritza)\
**Replies:** 2\
**Last updated:** [August 7, 2009, 10:50pm UTC](https://www.ruby-forum.com/t/polymorphic-belongs-to-with-class-name-abstract-class/173385 "2009-08-07T22:50:11Z")

</div>

SUMMARY: How do I assign objects, of different subclasses of an abstract class, to a belongs\_to relation? I had the following class hierarchy: Location \< ActiveRecord::Base Address \< Location Building \< Location an…

---

## [Newbie Confusion re underscores / camel case](https://www.ruby-forum.com/t/newbie-confusion-re-underscores-camel-case/173354)

<div class="topic-metadata">

**Author:** [@akm](https://www.ruby-forum.com/u/akm)\
**Replies:** 3\
**Last updated:** [August 7, 2009, 9:09pm UTC](https://www.ruby-forum.com/t/newbie-confusion-re-underscores-camel-case/173354 "2009-08-07T21:09:56Z")

</div>

Hi, I’m a Java and ColdFusion developer trying to find my feet with JRuby and Rails. I’ve created a very simple “Auction” app, with a database schema like this: create\_table “auction\_items”, :force =\> true do |t| t…

---

## [ActionController::UnknownAction (No action responded to 22](https://www.ruby-forum.com/t/actioncontroller-unknownaction-no-action-responded-to-22/173365)

<div class="topic-metadata">

**Author:** [@alexei-lexx](https://www.ruby-forum.com/u/alexei-lexx)\
**Replies:** 4\
**Last updated:** [August 7, 2009, 8:50pm UTC](https://www.ruby-forum.com/t/actioncontroller-unknownaction-no-action-responded-to-22/173365 "2009-08-07T20:50:40Z")

</div>

I try to switch my application from Rails 2.2.2 to Rails 2.3.3. In namespace :admin I have a resource-based controller. See controller class Admin::OSystemsController \< Admin::BaseController def index … end def edi…

---

## [2nd call, PostgreSQL Conference](https://www.ruby-forum.com/t/2nd-call-postgresql-conference/173390)

<div class="topic-metadata">

**Author:** [@Joshua\_DSDrake](https://www.ruby-forum.com/u/Joshua_DSDrake)\
**Replies:** 0\
**Last updated:** [August 7, 2009, 8:37pm UTC](https://www.ruby-forum.com/t/2nd-call-postgresql-conference/173390 "2009-08-07T20:37:42Z")

</div>

Hey folks, Let’s get some RoR love at the PostgreSQL Conference. The 2nd call for papers is out: http://www.postgresqlconference.org/ Joshua D. Drake PostgreSQL - XMPP: removed\_email\_address@domain.invalid Consultin…

---

## [Rjs works but gives some error](https://www.ruby-forum.com/t/rjs-works-but-gives-some-error/173380)

<div class="topic-metadata">

**Author:** [@nirosh](https://www.ruby-forum.com/u/nirosh)\
**Replies:** 2\
**Last updated:** [August 7, 2009, 8:17pm UTC](https://www.ruby-forum.com/t/rjs-works-but-gives-some-error/173380 "2009-08-07T20:17:13Z")

</div>

the link\_to\_remote ===================================================== \<%=link\_to\_remote "Click me",:url=\> {:action=\>"edit"},:update=\>"update\_me"%\> the rjs (edit.rjs) page.alert “test” the error message is …

---

## [Where to put generic classes](https://www.ruby-forum.com/t/where-to-put-generic-classes/173387)

<div class="topic-metadata">

**Author:** [@ghoti143](https://www.ruby-forum.com/u/ghoti143)\
**Replies:** 1\
**Last updated:** [August 7, 2009, 8:12pm UTC](https://www.ruby-forum.com/t/where-to-put-generic-classes/173387 "2009-08-07T20:12:32Z")

</div>

I have a file that has a generic class that supports serialization to/ from files. Where should I put this class? It really does not fit under the generic MVC directories. Thoughts?

---

## [Background daemon](https://www.ruby-forum.com/t/background-daemon/173033)

<div class="topic-metadata">

**Author:** [@penelope](https://www.ruby-forum.com/u/penelope)\
**Replies:** 6\
**Last updated:** [August 7, 2009, 6:34pm UTC](https://www.ruby-forum.com/t/background-daemon/173033 "2009-08-07T18:34:46Z")

</div>

It’s sending e-mail every hour, but I changed to sleep for a day, but keep send the e-mail by hour. I don’t know what to do to send daily. Could somebody help me? thanks ############ mailer.rb ############### #!/us…

---

## [Fastercsv of zip code and time zone made into hash](https://www.ruby-forum.com/t/fastercsv-of-zip-code-and-time-zone-made-into-hash/173381)

<div class="topic-metadata">

**Author:** [@Joshua\_Montross](https://www.ruby-forum.com/u/Joshua_Montross)\
**Replies:** 0\
**Last updated:** [August 7, 2009, 6:22pm UTC](https://www.ruby-forum.com/t/fastercsv-of-zip-code-and-time-zone-made-into-hash/173381 "2009-08-07T18:22:28Z")

</div>

I have a csv of zip code and time zone like so. array\_zipcodes = ‘ZIPCode,ZIPType,CityName,CityType,CountyName,CountyFIPS,StateName,StateAbbr,StateFIPS,MSACode,AreaCode,TimeZone,UTC,DST,Latitude,Longitude 00501,U,Holt…

---

## [Split an array of hashes into an array of arrays of hashes](https://www.ruby-forum.com/t/split-an-array-of-hashes-into-an-array-of-arrays-of-hashes/173323)

<div class="topic-metadata">

**Author:** [@nik](https://www.ruby-forum.com/u/nik)\
**Replies:** 4\
**Last updated:** [August 7, 2009, 6:15pm UTC](https://www.ruby-forum.com/t/split-an-array-of-hashes-into-an-array-of-arrays-of-hashes/173323 "2009-08-07T18:15:26Z")

</div>

Hello, I have this big array of hashes: A =\[ h0, h1, h2, …, hn\] some hi’s’ :cue key is true, others’ is false. e.g., h1\[:cue\] = false h2\[:cue\] = false h3\[:cue\] = true h4\[:cue\] = false h5\[:cue\] = true … hn\[:cue\]…

---

## [Login](https://www.ruby-forum.com/t/login/173347)

<div class="topic-metadata">

**Author:** [@hunt](https://www.ruby-forum.com/u/hunt)\
**Replies:** 1\
**Last updated:** [August 7, 2009, 6:02pm UTC](https://www.ruby-forum.com/t/login/173347 "2009-08-07T18:02:47Z")

</div>

I am developing an assignment for best ror practice. For the same, I am making a login & password form. It is something like that below LOGIN. Login : \_\_\_\_\_\_\_\_\_\_\_\_\_\_ Password : \_\_\_\_\_\_\_\_\_\_\_\_ Submit Register Forgot …

---

## [Count of child model in Model.find](https://www.ruby-forum.com/t/count-of-child-model-in-model-find/173374)

<div class="topic-metadata">

**Author:** [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Replies:** 7\
**Last updated:** [August 7, 2009, 5:49pm UTC](https://www.ruby-forum.com/t/count-of-child-model-in-model-find/173374 "2009-08-07T17:49:05Z")

</div>

Hi, Im trying to get all the users information along with the total number of orders they have placed. I have used the following below but keep getting messages like you should include “users.email” in group clause …

---

## [Maddening error: "marshal data too short"](https://www.ruby-forum.com/t/maddening-error-marshal-data-too-short/173359)

<div class="topic-metadata">

**Author:** [@Kyle\_F](https://www.ruby-forum.com/u/Kyle_F)\
**Replies:** 6\
**Last updated:** [August 7, 2009, 5:48pm UTC](https://www.ruby-forum.com/t/maddening-error-marshal-data-too-short/173359 "2009-08-07T17:48:30Z")

</div>

I’m occasionally getting an odd Rails error that says “marshal data too short”. Our entire web app seems to be working fine – we can post forms, save models, redirect, login, etc, without any problems. Then out of n…

---

## [Inner joins and outer joins](https://www.ruby-forum.com/t/inner-joins-and-outer-joins/173361)

<div class="topic-metadata">

**Author:** [@akramwasim1234](https://www.ruby-forum.com/u/akramwasim1234)\
**Replies:** 1\
**Last updated:** [August 7, 2009, 5:47pm UTC](https://www.ruby-forum.com/t/inner-joins-and-outer-joins/173361 "2009-08-07T17:47:25Z")

</div>

can anybody guide me on how to create inner joins and left and right outer joins in RoR as both the tables has “has and belongs to many relationships” and there is ajoin table as well

---

## [Render views from outside of controller for example in my modules in Lib directory](https://www.ruby-forum.com/t/render-views-from-outside-of-controller-for-example-in-my-modules-in-lib-directory/173373)

<div class="topic-metadata">

**Author:** [@firelinemx](https://www.ruby-forum.com/u/firelinemx)\
**Replies:** 1\
**Last updated:** [August 7, 2009, 5:15pm UTC](https://www.ruby-forum.com/t/render-views-from-outside-of-controller-for-example-in-my-modules-in-lib-directory/173373 "2009-08-07T17:15:43Z")

</div>

i render view from outside of controllers in my a module in lib folder, here is my render method: def render(options, assigns = {}) view = ActionView::Base.new (ActionController::Base.view\_paths,assigns) view.r…

---

## [Uploading a file and working with 2 models](https://www.ruby-forum.com/t/uploading-a-file-and-working-with-2-models/173376)

<div class="topic-metadata">

**Author:** [@rwhiten1](https://www.ruby-forum.com/u/rwhiten1)\
**Replies:** 1\
**Last updated:** [August 7, 2009, 4:47pm UTC](https://www.ruby-forum.com/t/uploading-a-file-and-working-with-2-models/173376 "2009-08-07T16:47:37Z")

</div>

I have an app that engages physical files of several types. Each type has different metadata associated, so i’ve broken them out in different models. To keep thing simple, I’ll just deal use images in my example. I h…

---

## [F.check\_box help](https://www.ruby-forum.com/t/f-check-box-help/173190)

<div class="topic-metadata">

**Author:** [@15characters](https://www.ruby-forum.com/u/15characters)\
**Replies:** 14\
**Last updated:** [August 7, 2009, 4:13pm UTC](https://www.ruby-forum.com/t/f-check-box-help/173190 "2009-08-07T16:13:39Z")

</div>

I have a mySQL table with a bit field called Monday, which is either 0 or 1, 1 being ‘checked’ and 0 being ‘not checked’. The default is 0. I have a check\_box form helper: \<%= f.label :Monday %\>\<%= f.check\_box :Monday…

---

## [Paperclip model fails while when updating with no attachment](https://www.ruby-forum.com/t/paperclip-model-fails-while-when-updating-with-no-attachment/173370)

<div class="topic-metadata">

**Author:** [@bagadoughnuts](https://www.ruby-forum.com/u/bagadoughnuts)\
**Replies:** 2\
**Last updated:** [August 7, 2009, 3:47pm UTC](https://www.ruby-forum.com/t/paperclip-model-fails-while-when-updating-with-no-attachment/173370 "2009-08-07T15:47:59Z")

</div>

Hi all, I have paperclip running in my rails environment. I setup a new model just for paperclip called Assets so that I could upload multiple files per item (even though I’m only using 1 attachment per item at the m…

---

## [Simple Syntax error](https://www.ruby-forum.com/t/simple-syntax-error/173360)

<div class="topic-metadata">

**Author:** [@kook](https://www.ruby-forum.com/u/kook)\
**Replies:** 3\
**Last updated:** [August 7, 2009, 3:47pm UTC](https://www.ruby-forum.com/t/simple-syntax-error/173360 "2009-08-07T15:47:55Z")

</div>

Care to take a minute and help out a newbie? :wink: I’ve tried everything I can think of, but I don’t come from a programming background. puts ‘What is your first name?’ first\_name = gets.chomp puts ‘Middle name?’ …

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

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