# Rails

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

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

---

## [Ajax in Rails](https://www.ruby-forum.com/t/ajax-in-rails/161719)

<div class="topic-metadata">

**Author:** [@phil7085](https://www.ruby-forum.com/u/phil7085)\
**Replies:** 15\
**Last updated:** [March 2, 2009, 10:19am UTC](https://www.ruby-forum.com/t/ajax-in-rails/161719 "2009-03-02T10:19:59Z")

</div>

Hi All, New to the group, and new to learning rails. I’m having some trouble, i’ve done a few tutorials on creating some small apps with rails and am now starting to play around myself. I’ve been trying to create a s…

---

## [ActiveWebService returning custom types](https://www.ruby-forum.com/t/activewebservice-returning-custom-types/161762)

<div class="topic-metadata">

**Author:** [@wanyixue](https://www.ruby-forum.com/u/wanyixue)\
**Replies:** 2\
**Last updated:** [March 2, 2009, 9:43am UTC](https://www.ruby-forum.com/t/activewebservice-returning-custom-types/161762 "2009-03-02T09:43:06Z")

</div>

class Sampleclass attr\_reader :temp\_arr,:temp\_hash,:temp\_str def initialize(temp\_arr,temp\_hash,temp\_str) @temp\_arr=temp\_arr @temp\_hash=temp\_hash @temp\_str=temp\_str end class TestApi \< ActionWebService::API::Base …

---

## [Preventing read access to a model](https://www.ruby-forum.com/t/preventing-read-access-to-a-model/161739)

<div class="topic-metadata">

**Author:** [@evan](https://www.ruby-forum.com/u/evan)\
**Replies:** 1\
**Last updated:** [March 2, 2009, 4:55am UTC](https://www.ruby-forum.com/t/preventing-read-access-to-a-model/161739 "2009-03-02T04:55:28Z")

</div>

In a model are there any methods that are called before providing access to the model? I’m exploring ways to enforce privileges in my app. Wondering if I can define some sort of “before” method in the model to prevent…

---

## [Accessing helpers within partials within helpers](https://www.ruby-forum.com/t/accessing-helpers-within-partials-within-helpers/161751)

<div class="topic-metadata">

**Author:** [@brendon](https://www.ruby-forum.com/u/brendon)\
**Replies:** 0\
**Last updated:** [March 2, 2009, 4:18am UTC](https://www.ruby-forum.com/t/accessing-helpers-within-partials-within-helpers/161751 "2009-03-02T04:18:39Z")

</div>

Hi everyone, not sure if this is a bug or just normal behaviour: From a layout file call a helper, inside that helper render a partial, inside that partial call a different helper. I find that the last helper doesn’t …

---

## [Validates\_uniqueness\_of - how did I get two users?](https://www.ruby-forum.com/t/validates-uniqueness-of-how-did-i-get-two-users/161676)

<div class="topic-metadata">

**Author:** [@philswenson](https://www.ruby-forum.com/u/philswenson)\
**Replies:** 3\
**Last updated:** [March 2, 2009, 1:09am UTC](https://www.ruby-forum.com/t/validates-uniqueness-of-how-did-i-get-two-users/161676 "2009-03-02T01:09:53Z")

</div>

I have the following in my user model: validates\_uniqueness\_of :login, :email, :case\_sensitive =\> false yet somehow I ended up with two users with the same email. Does this line mean that the COMBINATION is unique (…

---

## [Loading several locales files](https://www.ruby-forum.com/t/loading-several-locales-files/156311)

<div class="topic-metadata">

**Author:** [@micktaiwan](https://www.ruby-forum.com/u/micktaiwan)\
**Replies:** 1\
**Last updated:** [March 2, 2009, 12:14am UTC](https://www.ruby-forum.com/t/loading-several-locales-files/156311 "2009-03-02T00:14:20Z")

</div>

Hi, If I put my 2 locales en and fr in one file (config/locales/en.yml) english an french locales are loaded and I can switch between the two. But if I put the french local in a separate fr.yml file, then I get “tran…

---

## [Before\_save :strip\_whitespace =\> saves with spaces](https://www.ruby-forum.com/t/before-save-strip-whitespace-saves-with-spaces/159698)

<div class="topic-metadata">

**Author:** [@newb](https://www.ruby-forum.com/u/newb)\
**Replies:** 5\
**Last updated:** [March 1, 2009, 11:49pm UTC](https://www.ruby-forum.com/t/before-save-strip-whitespace-saves-with-spaces/159698 "2009-03-01T23:49:38Z")

</div>

i used this private function for removing leading and trailing white spaces from the values.that below function would be called before\_save. when i print the value after it strips.it prints string without any spaces.b…

---

## [Find or select across a many to many relationship](https://www.ruby-forum.com/t/find-or-select-across-a-many-to-many-relationship/161725)

<div class="topic-metadata">

**Author:** [@johnsonmlw](https://www.ruby-forum.com/u/johnsonmlw)\
**Replies:** 2\
**Last updated:** [March 1, 2009, 10:35pm UTC](https://www.ruby-forum.com/t/find-or-select-across-a-many-to-many-relationship/161725 "2009-03-01T22:35:48Z")

</div>

I have an incident model and a pupil model, and they have a many to many relationship through an involvement model. Also, a pupil belongs to a cohort. How can I show incidents (ideally just once), in date order, where …

---

## [Scope of Instance Variables with Partial Views](https://www.ruby-forum.com/t/scope-of-instance-variables-with-partial-views/161732)

<div class="topic-metadata">

**Author:** [@rube\_noob](https://www.ruby-forum.com/u/rube_noob)\
**Replies:** 3\
**Last updated:** [March 1, 2009, 10:22pm UTC](https://www.ruby-forum.com/t/scope-of-instance-variables-with-partial-views/161732 "2009-03-01T22:22:18Z")

</div>

Hello I do not understand how to use instance variable properly with partial views, I am hoping someone here can enlighten me. For example class MainController \< ApplicationController def index @item\_list = Item.fin…

---

## [Using belongs\_to within instance method](https://www.ruby-forum.com/t/using-belongs-to-within-instance-method/161729)

<div class="topic-metadata">

**Author:** [@david](https://www.ruby-forum.com/u/david)\
**Replies:** 1\
**Last updated:** [March 1, 2009, 9:42pm UTC](https://www.ruby-forum.com/t/using-belongs-to-within-instance-method/161729 "2009-03-01T21:42:13Z")

</div>

Is it possible to use model associations with an instance method? For example, I have: Class Reminder belongs\_to :event #and i want to access the event id within a Reminder instance method: def find\_event\_id id = …

---

## [Absolute Url with Link\_to](https://www.ruby-forum.com/t/absolute-url-with-link-to/161692)

<div class="topic-metadata">

**Author:** [@tashfeen.ekram](https://www.ruby-forum.com/u/tashfeen.ekram)\
**Replies:** 2\
**Last updated:** [March 1, 2009, 8:39pm UTC](https://www.ruby-forum.com/t/absolute-url-with-link-to/161692 "2009-03-01T20:39:56Z")

</div>

i am using link\_to to make links. it is gnerating urls relative to the path of the page. how do i make absolute urls. i tried using only\_path but it does nto seem to work. do i need to use url\_for? thanks

---

## [Using variable class names, how?](https://www.ruby-forum.com/t/using-variable-class-names-how/161682)

<div class="topic-metadata">

**Author:** [@msmsms](https://www.ruby-forum.com/u/msmsms)\
**Replies:** 8\
**Last updated:** [March 1, 2009, 8:33pm UTC](https://www.ruby-forum.com/t/using-variable-class-names-how/161682 "2009-03-01T20:33:29Z")

</div>

Hello, I’ve got some code, which I would like to reuse. The only difference between the usages are the class names and therefore the different objects. How would you manage this? Is there a way to take the class name…

---

## [Script/console using older Rails version](https://www.ruby-forum.com/t/script-console-using-older-rails-version/161441)

<div class="topic-metadata">

**Author:** [@dantelepoole](https://www.ruby-forum.com/u/dantelepoole)\
**Replies:** 6\
**Last updated:** [March 1, 2009, 6:48pm UTC](https://www.ruby-forum.com/t/script-console-using-older-rails-version/161441 "2009-03-01T18:48:36Z")

</div>

Hi all, I have an app running fine on Rails 2.2.2, but whenever I launch the script/console in the same app it loads Rails version 2.1.0. I wouldn’t really mind, except that every time I start the console I get a lot …

---

## [Ssl certificate](https://www.ruby-forum.com/t/ssl-certificate/161658)

<div class="topic-metadata">

**Author:** [@ashikalim](https://www.ruby-forum.com/u/ashikalim)\
**Replies:** 6\
**Last updated:** [March 1, 2009, 6:46pm UTC](https://www.ruby-forum.com/t/ssl-certificate/161658 "2009-03-01T18:46:33Z")

</div>

Can anyone tell me which is best either self-signed or VeriSign certificate ? cheers, ashikali

---

## [Problems using nested objects in a test](https://www.ruby-forum.com/t/problems-using-nested-objects-in-a-test/161712)

<div class="topic-metadata">

**Author:** [@cojones](https://www.ruby-forum.com/u/cojones)\
**Replies:** 3\
**Last updated:** [March 1, 2009, 6:04pm UTC](https://www.ruby-forum.com/t/problems-using-nested-objects-in-a-test/161712 "2009-03-01T18:04:39Z")

</div>

Hey, I’m having some problems testing the creation of objects with nested objects. First of all, the test itself: def test\_should\_create\_user assert\_difference(‘User.count’) do post :create, :user =\> { :character =\>…

---

## [Permalink\_fu - update existing records?](https://www.ruby-forum.com/t/permalink-fu-update-existing-records/161707)

<div class="topic-metadata">

**Author:** [@railslist](https://www.ruby-forum.com/u/railslist)\
**Replies:** 2\
**Last updated:** [March 1, 2009, 5:31pm UTC](https://www.ruby-forum.com/t/permalink-fu-update-existing-records/161707 "2009-03-01T17:31:32Z")

</div>

i am experimenting to use permalink\_fu to provide clean urls. To begin with, I have installed it and made necessary changes to models, routes etc. As I have existing records in table, I wanted to update its permalin…

---

## [Atom\_builder and link element](https://www.ruby-forum.com/t/atom-builder-and-link-element/161716)

<div class="topic-metadata">

**Author:** [@KevinJones](https://www.ruby-forum.com/u/KevinJones)\
**Replies:** 0\
**Last updated:** [March 1, 2009, 5:02pm UTC](https://www.ruby-forum.com/t/atom-builder-and-link-element/161716 "2009-03-01T17:02:50Z")

</div>

I’m using the atom builder to build a feed. It’s mostly working but the value in the link element of each entry is not being generated as it needs to be. My url scheme looks like http://example.com/blog/nickname/id I…

---

## [RMagick](https://www.ruby-forum.com/t/rmagick/80173)

<div class="topic-metadata">

**Author:** [@pete.d](https://www.ruby-forum.com/u/pete.d)\
**Replies:** 24\
**Last updated:** [March 1, 2009, 3:22pm UTC](https://www.ruby-forum.com/t/rmagick/80173 "2009-03-01T15:22:25Z")

</div>

Does anyone know how to solve ‘No such file to load – RMagick’ on ‘Instant Rails’?

---

## [Undefined method 'insert\_record' on ActiveRecord save](https://www.ruby-forum.com/t/undefined-method-insert-record-on-activerecord-save/133085)

<div class="topic-metadata">

**Author:** [@df-sean](https://www.ruby-forum.com/u/df-sean)\
**Replies:** 1\
**Last updated:** [March 1, 2009, 2:39pm UTC](https://www.ruby-forum.com/t/undefined-method-insert-record-on-activerecord-save/133085 "2009-03-01T14:39:36Z")

</div>

Each time I try to save a particular model class (in this case a Batch) in my application, I receive the following error: undefined method \`insert\_record’ for #Array:0x4c8fc7c It seems that ActiveRecord is somehow get…

---

## [Sortable\_element helper query](https://www.ruby-forum.com/t/sortable-element-helper-query/161694)

<div class="topic-metadata">

**Author:** [@amita0204](https://www.ruby-forum.com/u/amita0204)\
**Replies:** 1\
**Last updated:** [March 1, 2009, 12:28pm UTC](https://www.ruby-forum.com/t/sortable-element-helper-query/161694 "2009-03-01T12:28:42Z")

</div>

Is it possible to call helper method instead of controller action while using sortable\_element helper method? Ref: http://api.rubyonrails.org/classes/ActionView/Helpers/ScriptaculousHelper.html The url field in the e…

---

## [What's wrong with this applet tag (trying to get an applet rendering in a RoR page)](https://www.ruby-forum.com/t/whats-wrong-with-this-applet-tag-trying-to-get-an-applet-rendering-in-a-ror-page/161512)

<div class="topic-metadata">

**Author:** [@greg](https://www.ruby-forum.com/u/greg)\
**Replies:** 1\
**Last updated:** [March 1, 2009, 12:19pm UTC](https://www.ruby-forum.com/t/whats-wrong-with-this-applet-tag-trying-to-get-an-applet-rendering-in-a-ror-page/161512 "2009-03-01T12:19:55Z")

</div>

Hi, Any ideas why this tag: is giving me this error (from Rails standard out) ActionController::RoutingError (No route matches “/applet/org/gregnet/NewJApplet.class” with {:method=\>:get}): Any ideas? – Greg h…

---

## [I18n date formatting rails 2.2.2](https://www.ruby-forum.com/t/i18n-date-formatting-rails-2-2-2/161686)

<div class="topic-metadata">

**Author:** [@ronald](https://www.ruby-forum.com/u/ronald)\
**Replies:** 2\
**Last updated:** [March 1, 2009, 12:10pm UTC](https://www.ruby-forum.com/t/i18n-date-formatting-rails-2-2-2/161686 "2009-03-01T12:10:31Z")

</div>

Hello everyone, I’m trying to get Rails (v2.2.2) to print dates in Dutch but it won’t pick up the formats I specify. :frowning: I tried the following: created a ‘nl.yml’ file under ‘config/locales’ copied over the E…

---

## [String ID -\> schema.rb incorrect?](https://www.ruby-forum.com/t/string-id-schema-rb-incorrect/161699)

<div class="topic-metadata">

**Author:** [@Martin\_Vielsmaier](https://www.ruby-forum.com/u/Martin_Vielsmaier)\
**Replies:** 0\
**Last updated:** [March 1, 2009, 11:27am UTC](https://www.ruby-forum.com/t/string-id-schema-rb-incorrect/161699 "2009-03-01T11:27:42Z")

</div>

Hi, I made one of my ID columns a string, because I don’t want my IDs to be guessable (I use a md5 hash of some system parameters with rehashing in case of collisions.) My migration reads: … change\_column :users, :…

---

## [My new (ruby, rails, random) blog](https://www.ruby-forum.com/t/my-new-ruby-rails-random-blog/161698)

<div class="topic-metadata">

**Author:** [@mgreenly](https://www.ruby-forum.com/u/mgreenly)\
**Replies:** 0\
**Last updated:** [March 1, 2009, 10:50am UTC](https://www.ruby-forum.com/t/my-new-ruby-rails-random-blog/161698 "2009-03-01T10:50:11Z")

</div>

Yea, I hate it when people spam huge lists with random blog posts too. I’ve started a blogging attempt that has, so far anyway, about 90% Ruby content, most of which is directly related to Rails. Not all of it is ded…

---

## [Ajax.updater to call app\_helper or model method](https://www.ruby-forum.com/t/ajax-updater-to-call-app-helper-or-model-method/161689)

<div class="topic-metadata">

**Author:** [@neubyr](https://www.ruby-forum.com/u/neubyr)\
**Replies:** 6\
**Last updated:** [March 1, 2009, 10:13am UTC](https://www.ruby-forum.com/t/ajax-updater-to-call-app-helper-or-model-method/161689 "2009-03-01T10:13:39Z")

</div>

I am quite newbie to rails and stuck with a problem. In my application I have a Ajax.updater call to update counties list in a select drop down whenever a city name is selected. I need to do this in many place in my a…

---

## [Expiring cache from a rake task](https://www.ruby-forum.com/t/expiring-cache-from-a-rake-task/160056)

<div class="topic-metadata">

**Author:** [@Levy\_Carneiro\_Jr](https://www.ruby-forum.com/u/Levy_Carneiro_Jr)\
**Replies:** 3\
**Last updated:** [March 1, 2009, 5:33am UTC](https://www.ruby-forum.com/t/expiring-cache-from-a-rake-task/160056 "2009-03-01T05:33:00Z")

</div>

Hello, I have a question on cache expiration only working from the web, and not from the console or from a rake task. I have 2 models, Post e Comments. I have this page /archives where I list all old posts. I create…

---

## [Adding the conditions when parameter is available](https://www.ruby-forum.com/t/adding-the-conditions-when-parameter-is-available/161691)

<div class="topic-metadata">

**Author:** [@builtbysimple](https://www.ruby-forum.com/u/builtbysimple)\
**Replies:** 4\
**Last updated:** [March 1, 2009, 4:45am UTC](https://www.ruby-forum.com/t/adding-the-conditions-when-parameter-is-available/161691 "2009-03-01T04:45:02Z")

</div>

Hi all, How do we add a conditions in a ActiveRecord find method when the parameter is available? Lets say I want to add this category conditions when the parameter from the client: Product.find(:all, :conditions =\> …

---

## [Warning users that the site is coming down for maintenance](https://www.ruby-forum.com/t/warning-users-that-the-site-is-coming-down-for-maintenance/161616)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 1\
**Last updated:** [March 1, 2009, 3:13am UTC](https://www.ruby-forum.com/t/warning-users-that-the-site-is-coming-down-for-maintenance/161616 "2009-03-01T03:13:02Z")

</div>

Hi. I have a site that is currently running in alpha mode. I have warned my users that it will be bouncing up and down as I deploy updates. That said, i’d like to broadcast a real time warning to them when I am about …

---

## [Rails find :conditions seems to remove extra blanks? (e.g. where description = 'x x x x x') is this](https://www.ruby-forum.com/t/rails-find-conditions-seems-to-remove-extra-blanks-e-g-where-description-x-x-x-x-x-is-this/161525)

<div class="topic-metadata">

**Author:** [@greg](https://www.ruby-forum.com/u/greg)\
**Replies:** 3\
**Last updated:** [March 1, 2009, 1:13am UTC](https://www.ruby-forum.com/t/rails-find-conditions-seems-to-remove-extra-blanks-e-g-where-description-x-x-x-x-x-is-this/161525 "2009-03-01T01:13:29Z")

</div>

Hi, Is this a Rails bug? NORMAL SQL ?\> AccountItem.find\_by\_sql( “select \* from account\_items where description = ‘FISHERS IGA HAMILTON HAMILTON AU 000318’”) =\> \[#\<AccountItem id: 1100, account\_id: 5, recurr…

---

## [Regular Expression question](https://www.ruby-forum.com/t/regular-expression-question/161612)

<div class="topic-metadata">

**Author:** [@northband](https://www.ruby-forum.com/u/northband)\
**Replies:** 7\
**Last updated:** [March 1, 2009, 12:30am UTC](https://www.ruby-forum.com/t/regular-expression-question/161612 "2009-03-01T00:30:40Z")

</div>

Hi - I would like to use gsub() to strip decimals with trailing zeros from a string. My string looks like this: 19.0 " / 482.600 mm I would like to end up with this: 19 " / 482.6 mm Anyone have a regular expression th…

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

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