# Rails

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

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

---

## [Partial not finding variable](https://www.ruby-forum.com/t/partial-not-finding-variable/142548)

<div class="topic-metadata">

**Author:** [@THEBIGO](https://www.ruby-forum.com/u/THEBIGO)\
**Replies:** 5\
**Last updated:** [July 10, 2008, 2:04am UTC](https://www.ruby-forum.com/t/partial-not-finding-variable/142548 "2008-07-10T02:04:18Z")

</div>

Hello - am still very new and need any help available I have a user model class User \< ActiveRecord::Base has\_many :calls has\_many :visits has\_many :calls\_visited, :through =\> :visits, :source =\> :call has\_many:c…

---

## [Find if child element is nil](https://www.ruby-forum.com/t/find-if-child-element-is-nil/142553)

<div class="topic-metadata">

**Author:** [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Replies:** 6\
**Last updated:** [July 10, 2008, 2:04am UTC](https://www.ruby-forum.com/t/find-if-child-element-is-nil/142553 "2008-07-10T02:04:18Z")

</div>

so i have a parent and child model, i need to get all the entries in my parent model that don’t yet have a child. i can do a find all and iterate through all the buggers, but this is a little cpu intensive. How can i …

---

## [ActiveRecord: Private or Readonly attributes? like attr\_reader?](https://www.ruby-forum.com/t/activerecord-private-or-readonly-attributes-like-attr-reader/139930)

<div class="topic-metadata">

**Author:** [@Jesse\_Thompson](https://www.ruby-forum.com/u/Jesse_Thompson)\
**Replies:** 4\
**Last updated:** [July 10, 2008, 1:22am UTC](https://www.ruby-forum.com/t/activerecord-private-or-readonly-attributes-like-attr-reader/139930 "2008-07-10T01:22:43Z")

</div>

in a standard class, it is possible to allow reading of attributes while disallowing writing. I know ActiveRecord has an “attr\_readonly” deal but it doesn’t stop you or throw an exception at the time of writing to the…

---

## [Redirect :back clears my form Data](https://www.ruby-forum.com/t/redirect-back-clears-my-form-data/142648)

<div class="topic-metadata">

**Author:** [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Replies:** 1\
**Last updated:** [July 10, 2008, 1:20am UTC](https://www.ruby-forum.com/t/redirect-back-clears-my-form-data/142648 "2008-07-10T01:20:57Z")

</div>

I have a login form on the left side of a page. The user can always log in at any time this way. when they do I use redirect :back as an easy way to get back to the page they were viewing before they attempted to log …

---

## [Rendering a collection of partial inserted in their layout](https://www.ruby-forum.com/t/rendering-a-collection-of-partial-inserted-in-their-layout/142650)

<div class="topic-metadata">

**Author:** [@itkin](https://www.ruby-forum.com/u/itkin)\
**Replies:** 0\
**Last updated:** [July 10, 2008, 1:16am UTC](https://www.ruby-forum.com/t/rendering-a-collection-of-partial-inserted-in-their-layout/142650 "2008-07-10T01:16:31Z")

</div>

hi ! i’ve to render a collection of partial, each element need to be inserted in a layout which render the html presentation. collection\_element\_1 collection\_element\_2 ... render :partial, collection =\> @coll…

---

## [Unit test patterned after AWDR p. 186 doesn't work as expect](https://www.ruby-forum.com/t/unit-test-patterned-after-awdr-p-186-doesnt-work-as-expect/142640)

<div class="topic-metadata">

**Author:** [@rainyglade](https://www.ruby-forum.com/u/rainyglade)\
**Replies:** 2\
**Last updated:** [July 10, 2008, 1:04am UTC](https://www.ruby-forum.com/t/unit-test-patterned-after-awdr-p-186-doesnt-work-as-expect/142640 "2008-07-10T01:04:52Z")

</div>

I have the following Ruby migration: class CreateSimulations \< ActiveRecord::Migration def self.up create\_table :simulations do |t| t.string :name, :desc, :time\_units t.column :run\_length, :float t.timestamps e…

---

## [Using if statements in View](https://www.ruby-forum.com/t/using-if-statements-in-view/142638)

<div class="topic-metadata">

**Author:** [@recent\_convert\_S\_me](https://www.ruby-forum.com/u/recent_convert_S_me)\
**Replies:** 1\
**Last updated:** [July 10, 2008, 12:00am UTC](https://www.ruby-forum.com/t/using-if-statements-in-view/142638 "2008-07-10T00:00:49Z")

</div>

Hi out there. I am trying to create a table that displays information, and then changes the class of the row if a flag is presented, but can’t determine if putting it in the view is the best method for doing so or no…

---

## [Registering gem dependency within plugin?](https://www.ruby-forum.com/t/registering-gem-dependency-within-plugin/142636)

<div class="topic-metadata">

**Author:** [@thorny\_sun](https://www.ruby-forum.com/u/thorny_sun)\
**Replies:** 0\
**Last updated:** [July 9, 2008, 11:47pm UTC](https://www.ruby-forum.com/t/registering-gem-dependency-within-plugin/142636 "2008-07-09T23:47:56Z")

</div>

Rails Gurus – In 2.1, is there a way to get a plugin to register a gem as a dependency. I was unable to get this working from the plugin’s init.rb-- it seems that it is read in too late in the init process? Is there…

---

## [Multiview: Format fallback from fbml to html (register\_alias/request.format)](https://www.ruby-forum.com/t/multiview-format-fallback-from-fbml-to-html-register-alias-request-format/142637)

<div class="topic-metadata">

**Author:** [@Paul\_Canavese](https://www.ruby-forum.com/u/Paul_Canavese)\
**Replies:** 0\
**Last updated:** [July 9, 2008, 11:47pm UTC](https://www.ruby-forum.com/t/multiview-format-fallback-from-fbml-to-html-register-alias-request-format/142637 "2008-07-09T23:47:56Z")

</div>

I’m using Rails 2.1 with the Multiview template mechanism to create a hybrid Facebook and public site. For the most part, there are analogous views across the two. Since Facebook supports a subset of HTML, some of m…

---

## [Sr Rails opportunity-telecommute $100-$150K](https://www.ruby-forum.com/t/sr-rails-opportunity-telecommute-100-150k/142635)

<div class="topic-metadata">

**Author:** [@LynnConrad](https://www.ruby-forum.com/u/LynnConrad)\
**Replies:** 0\
**Last updated:** [July 9, 2008, 11:47pm UTC](https://www.ruby-forum.com/t/sr-rails-opportunity-telecommute-100-150k/142635 "2008-07-09T23:47:21Z")

</div>

Hi, my name is Lynn, am a recruiter with The Conrad Group. I currently have the following Senior Ruby on Rails opening with a client company that is an organization of developers and engineers who are excited about t…

---

## [Bug in Model.count?](https://www.ruby-forum.com/t/bug-in-model-count/142631)

<div class="topic-metadata">

**Author:** [@arvias](https://www.ruby-forum.com/u/arvias)\
**Replies:** 0\
**Last updated:** [July 9, 2008, 10:46pm UTC](https://www.ruby-forum.com/t/bug-in-model-count/142631 "2008-07-09T22:46:10Z")

</div>

Hi, I am trying to get number of events of by a certain person in a time period. My activerecord syntax is: Event.count(:group =\> \[ ‘DATE(created\_at), user\_id’ \]) This returns something like: =\> \[\[“1”, 3\], \[“3”, 1\]…

---

## [How to set row height in active scaffold html table?](https://www.ruby-forum.com/t/how-to-set-row-height-in-active-scaffold-html-table/142621)

<div class="topic-metadata">

**Author:** [@dzhou](https://www.ruby-forum.com/u/dzhou)\
**Replies:** 1\
**Last updated:** [July 9, 2008, 8:22pm UTC](https://www.ruby-forum.com/t/how-to-set-row-height-in-active-scaffold-html-table/142621 "2008-07-09T20:22:01Z")

</div>

I have a products table created in active scaffold and html table display is fine.But the product descriptions are too long for some products and it stretches the html TD cell. Now I want to limit the TD height and ma…

---

## [Script/generate scaffold user](https://www.ruby-forum.com/t/script-generate-scaffold-user/142615)

<div class="topic-metadata">

**Author:** [@jturney](https://www.ruby-forum.com/u/jturney)\
**Replies:** 11\
**Last updated:** [July 9, 2008, 8:18pm UTC](https://www.ruby-forum.com/t/script-generate-scaffold-user/142615 "2008-07-09T20:18:35Z")

</div>

NameError in UsersController#index uninitialized constant UsersController::User RAILS\_ROOT: C:/RailsApps/rgams Application Trace | Framework Trace | Full Trace c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/a…

---

## [I want to Use each block only a certain # of times](https://www.ruby-forum.com/t/i-want-to-use-each-block-only-a-certain-of-times/142598)

<div class="topic-metadata">

**Author:** [@THEBIGO](https://www.ruby-forum.com/u/THEBIGO)\
**Replies:** 8\
**Last updated:** [July 9, 2008, 8:15pm UTC](https://www.ruby-forum.com/t/i-want-to-use-each-block-only-a-certain-of-times/142598 "2008-07-09T20:15:34Z")

</div>

I’m a newb with a simple question I have been researching everywhere I have a block \<% @current\_user.calls.each do |c| % \<%= link\_to c.name, etc,blah blah blah -%\> \<& end %\> and it does this for all the current\_use…

---

## [From Instant Rails 2.0 to Rails 2.1.0](https://www.ruby-forum.com/t/from-instant-rails-2-0-to-rails-2-1-0/141221)

<div class="topic-metadata">

**Author:** [@zhiguang](https://www.ruby-forum.com/u/zhiguang)\
**Replies:** 12\
**Last updated:** [July 9, 2008, 8:11pm UTC](https://www.ruby-forum.com/t/from-instant-rails-2-0-to-rails-2-1-0/141221 "2008-07-09T20:11:04Z")

</div>

hi, I have installed Instant Rails 2.0 on my machine which comes with Rails 2.0.2. Now I want to update my Rails to version 2.1.0. So I do gem update rails and It seems to be fine. But when I check the version of my …

---

## [Adding new column to table - browser not showing it](https://www.ruby-forum.com/t/adding-new-column-to-table-browser-not-showing-it/140388)

<div class="topic-metadata">

**Author:** [@editkid](https://www.ruby-forum.com/u/editkid)\
**Replies:** 10\
**Last updated:** [July 9, 2008, 7:47pm UTC](https://www.ruby-forum.com/t/adding-new-column-to-table-browser-not-showing-it/140388 "2008-07-09T19:47:54Z")

</div>

Hi, I’m trying to add a â€œDate availableâ€ column to a â€œProductsâ€ table. Hereâ€™s what I typed in and got back: ruby script/generate migration AddDate\_availableToProducts date\_available:datetime exists db/migra…

---

## [List.rhtml error](https://www.ruby-forum.com/t/list-rhtml-error/142422)

<div class="topic-metadata">

**Author:** [@harsh](https://www.ruby-forum.com/u/harsh)\
**Replies:** 3\
**Last updated:** [July 9, 2008, 6:55pm UTC](https://www.ruby-forum.com/t/list-rhtml-error/142422 "2008-07-09T18:55:47Z")

</div>

dear frnds… pls help me i hv stuck up in solving thw cookbook2 tutorial… in this i stuck at the point of creating views in which i have to create list.rhtml in views part of mine application and i have to change in …

---

## [\[ANN\] Princely - Prince XML PDF Wrapper Plugin](https://www.ruby-forum.com/t/ann-princely-prince-xml-pdf-wrapper-plugin/123831)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 1\
**Last updated:** [July 9, 2008, 6:38pm UTC](https://www.ruby-forum.com/t/ann-princely-prince-xml-pdf-wrapper-plugin/123831 "2008-07-09T18:38:59Z")

</div>

Recently I was implementing PDF generation for a project utilizing the fantastic library Prince XML (http://www.princexml.com). I came across a blog article with a basic library and helper set for Prince (http:// subl…

---

## [Join Association Destroy](https://www.ruby-forum.com/t/join-association-destroy/142614)

<div class="topic-metadata">

**Author:** [@Jorg\_L](https://www.ruby-forum.com/u/Jorg_L)\
**Replies:** 2\
**Last updated:** [July 9, 2008, 6:27pm UTC](https://www.ruby-forum.com/t/join-association-destroy/142614 "2008-07-09T18:27:42Z")

</div>

In the future will Active Record delete the child records in an association when the parents are deleted? Certainly one can add code in the controller or the database to take care of avoiding orphans but it really see…

---

## [Simple app works fine but unit tests don't work as intended](https://www.ruby-forum.com/t/simple-app-works-fine-but-unit-tests-dont-work-as-intended/142609)

<div class="topic-metadata">

**Author:** [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Replies:** 3\
**Last updated:** [July 9, 2008, 6:17pm UTC](https://www.ruby-forum.com/t/simple-app-works-fine-but-unit-tests-dont-work-as-intended/142609 "2008-07-09T18:17:10Z")

</div>

I have a simple rails 2.0.2 app with one model, Portfolio, and generated CRUD. I’ve added validation to the model and tested it thoroughly by hand – it works fine. I tried to create a unit test to ensure no inadverte…

---

## [Format date input on active scaffold form](https://www.ruby-forum.com/t/format-date-input-on-active-scaffold-form/138594)

<div class="topic-metadata">

**Author:** [@david](https://www.ruby-forum.com/u/david)\
**Replies:** 1\
**Last updated:** [July 9, 2008, 6:14pm UTC](https://www.ruby-forum.com/t/format-date-input-on-active-scaffold-form/138594 "2008-07-09T18:14:09Z")

</div>

Hi, Being new to RoR, I have had difficulty finding information regarding date formats for active scaffold. I have a DATE field on the create form of one of my controllers. For this specific controller, I would lik…

---

## [Newbie: has\_many/belongs\_to trouble in my view](https://www.ruby-forum.com/t/newbie-has-many-belongs-to-trouble-in-my-view/142576)

<div class="topic-metadata">

**Author:** [@scottnj](https://www.ruby-forum.com/u/scottnj)\
**Replies:** 4\
**Last updated:** [July 9, 2008, 5:43pm UTC](https://www.ruby-forum.com/t/newbie-has-many-belongs-to-trouble-in-my-view/142576 "2008-07-09T17:43:45Z")

</div>

i’m trying to learn some rails and have been doing great up to now. i have a has\_many/belongs\_to relationship. i got the new/edit forms working with a select box and i confirmed the urischeme\_id shows up in the websit…

---

## [Can I put seperate models into different directories](https://www.ruby-forum.com/t/can-i-put-seperate-models-into-different-directories/142514)

<div class="topic-metadata">

**Author:** [@Iain\_A](https://www.ruby-forum.com/u/Iain_A)\
**Replies:** 3\
**Last updated:** [July 9, 2008, 5:33pm UTC](https://www.ruby-forum.com/t/can-i-put-seperate-models-into-different-directories/142514 "2008-07-09T17:33:28Z")

</div>

I have alot of models that are all linked. They are cluttering up my app/models directory. Is it possible to move some of my models into a sub directory. (i.e. app/models/items) Will Rails still pick these up? Do I ne…

---

## [Access Data Outside of Active Record](https://www.ruby-forum.com/t/access-data-outside-of-active-record/142538)

<div class="topic-metadata">

**Author:** [@jobu](https://www.ruby-forum.com/u/jobu)\
**Replies:** 6\
**Last updated:** [July 9, 2008, 5:29pm UTC](https://www.ruby-forum.com/t/access-data-outside-of-active-record/142538 "2008-07-09T17:29:38Z")

</div>

I’d like to write a data import script as a rake task. It would execute a moderately complex query against some legacy tables returning a recordset. I’d like to get the results of that recordset into the rake task a…

---

## [Adding new records to a form](https://www.ruby-forum.com/t/adding-new-records-to-a-form/142606)

<div class="topic-metadata">

**Author:** [@markmt](https://www.ruby-forum.com/u/markmt)\
**Replies:** 0\
**Last updated:** [July 9, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/adding-new-records-to-a-form/142606 "2008-07-09T17:24:20Z")

</div>

Hi, I have a form that contains data for multiple records from a DB table and that allows me to add new fields, corresponding to new DB rows using a little ajax response to an “add item” link. Before I added the abili…

---

## [Join Association Question](https://www.ruby-forum.com/t/join-association-question/142601)

<div class="topic-metadata">

**Author:** [@Jorg\_L](https://www.ruby-forum.com/u/Jorg_L)\
**Replies:** 2\
**Last updated:** [July 9, 2008, 5:14pm UTC](https://www.ruby-forum.com/t/join-association-question/142601 "2008-07-09T17:14:56Z")

</div>

I have Employee and Skillset which are joined through an Association employees\_skillsets. When I use the for to add a new employee and mapping one or more id’s from skillset into employee\_skillset\_ids everything work…

---

## [Inline\_attachment in ActionMailer](https://www.ruby-forum.com/t/inline-attachment-in-actionmailer/142568)

<div class="topic-metadata">

**Author:** [@ssk](https://www.ruby-forum.com/u/ssk)\
**Replies:** 2\
**Last updated:** [July 9, 2008, 5:12pm UTC](https://www.ruby-forum.com/t/inline-attachment-in-actionmailer/142568 "2008-07-09T17:12:48Z")

</div>

Hi, I need to embed images in email that I send from rails app. ActionMailer seems to support only part and attachment.(Is it true?) So I’m trying to use inline\_attachment gem. My hosting server doesn’t have the gem.…

---

## [Senior Rails Telecommute opening....Great Opportunity $100-$150K](https://www.ruby-forum.com/t/senior-rails-telecommute-opening-great-opportunity-100-150k/142603)

<div class="topic-metadata">

**Author:** [@Lynn](https://www.ruby-forum.com/u/Lynn)\
**Replies:** 0\
**Last updated:** [July 9, 2008, 5:11pm UTC](https://www.ruby-forum.com/t/senior-rails-telecommute-opening-great-opportunity-100-150k/142603 "2008-07-09T17:11:59Z")

</div>

Hi, I’m a recruiter with The Conrad Group. I currently have the following Senior Ruby on Rails opening with a client company that is an organization of developers and engineers who are excited about the ever-changing …

---

## [Sessions in Rails](https://www.ruby-forum.com/t/sessions-in-rails/142577)

<div class="topic-metadata">

**Author:** [@Piyush\_with\_Rails](https://www.ruby-forum.com/u/Piyush_with_Rails)\
**Replies:** 3\
**Last updated:** [July 9, 2008, 4:57pm UTC](https://www.ruby-forum.com/t/sessions-in-rails/142577 "2008-07-09T16:57:51Z")

</div>

Hi, I am using sessions in my application and file store for sessions storage. now i want to expire my session after some short of idle time.for that i need the start time of the session. Does Any one know how can i…

---

## [Data type of input type file](https://www.ruby-forum.com/t/data-type-of-input-type-file/142451)

<div class="topic-metadata">

**Author:** [@doug](https://www.ruby-forum.com/u/doug)\
**Replies:** 6\
**Last updated:** [July 9, 2008, 4:52pm UTC](https://www.ruby-forum.com/t/data-type-of-input-type-file/142451 "2008-07-09T16:52:11Z")

</div>

If I have a form that includes something like: and I try to get at the file content using: params\[‘file\_content’\].read I get: undefined method \`read’ for “filename”:String where “filename” is the NAME of the file t…

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

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