# Rails

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

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

---

## [How to prettify/Railsify this SQL in will\_paginate?](https://www.ruby-forum.com/t/how-to-prettify-railsify-this-sql-in-will-paginate/180008)

<div class="topic-metadata">

**Author:** [@trevoke](https://www.ruby-forum.com/u/trevoke)\
**Replies:** 2\
**Last updated:** [December 9, 2009, 6:57pm UTC](https://www.ruby-forum.com/t/how-to-prettify-railsify-this-sql-in-will-paginate/180008 "2009-12-09T18:57:45Z")

</div>

I have the following code in my model: class DictatedExam \< ActiveRecord::Base belongs\_to :patient def self.search\_by\_name(search, page) query = %Q{ SELECT DE.\* FROM dictated\_exams DE INNER JOIN patients P on P.id =…

---

## [ActionMailer content set to charset big5](https://www.ruby-forum.com/t/actionmailer-content-set-to-charset-big5/180016)

<div class="topic-metadata">

**Author:** [@artchrst](https://www.ruby-forum.com/u/artchrst)\
**Replies:** 0\
**Last updated:** [December 9, 2009, 6:35pm UTC](https://www.ruby-forum.com/t/actionmailer-content-set-to-charset-big5/180016 "2009-12-09T18:35:14Z")

</div>

Hi Guys, I just fixed the problem in setting up the action\_mailer default\_charset. Now, I succeeded in sending email with content-type big5. HOwever, the content of the email is still utf-8! I’ve tried to call the .…

---

## [Email charset - invalid byte sequence in UTF-8](https://www.ruby-forum.com/t/email-charset-invalid-byte-sequence-in-utf-8/180014)

<div class="topic-metadata">

**Author:** [@artchrst](https://www.ruby-forum.com/u/artchrst)\
**Replies:** 0\
**Last updated:** [December 9, 2009, 5:51pm UTC](https://www.ruby-forum.com/t/email-charset-invalid-byte-sequence-in-utf-8/180014 "2009-12-09T17:51:27Z")

</div>

Hi Guys, I’m using action\_mail to deliver a big5 charset email (but using “…”.encode(“big5”) in the .erb. However, it returned invalid byte sequence in UTF-8 string. How can I force it to use big5 in action mailer? T…

---

## [Fading](https://www.ruby-forum.com/t/fading/179996)

<div class="topic-metadata">

**Author:** [@mercurius](https://www.ruby-forum.com/u/mercurius)\
**Replies:** 3\
**Last updated:** [December 9, 2009, 5:27pm UTC](https://www.ruby-forum.com/t/fading/179996 "2009-12-09T17:27:08Z")

</div>

I have an error message that is outputted as so: \<%= flash\[:notice\] %\> flash\[:notice\] is defined in my web\_controller. I want a fading effect on this text to draw more attention to it. Is there a simple way to do thi…

---

## [Testing errors](https://www.ruby-forum.com/t/testing-errors/179916)

<div class="topic-metadata">

**Author:** [@sanjanad](https://www.ruby-forum.com/u/sanjanad)\
**Replies:** 1\
**Last updated:** [December 9, 2009, 4:45pm UTC](https://www.ruby-forum.com/t/testing-errors/179916 "2009-12-09T16:45:47Z")

</div>

def test\_create num\_articles = Article.count post :create, :article =\> {} assert\_response :redirect assert\_redirected\_to :action =\> 'list' assert\_equal num\_articles + 1, Article.count end def test\_edit get :edit, …

---

## [Syntax error, unexpected kENSURE, expecting $end](https://www.ruby-forum.com/t/syntax-error-unexpected-kensure-expecting-end/180005)

<div class="topic-metadata">

**Author:** [@max\_1219](https://www.ruby-forum.com/u/max_1219)\
**Replies:** 4\
**Last updated:** [December 9, 2009, 4:37pm UTC](https://www.ruby-forum.com/t/syntax-error-unexpected-kensure-expecting-end/180005 "2009-12-09T16:37:26Z")

</div>

i m newbie to ROR. under views, i create a new.html.erb as following: \<%=form\_tag :action =\> ‘create’ %\> \<%= render :partial =\> ‘form’ %\> \<%= submit\_tag ‘Create’ %\> \<% end %\> \<%= link\_to ‘Back’, :action =\> ‘index’…

---

## [Validates\_presence\_of file fields](https://www.ruby-forum.com/t/validates-presence-of-file-fields/179968)

<div class="topic-metadata">

**Author:** [@tabassman](https://www.ruby-forum.com/u/tabassman)\
**Replies:** 5\
**Last updated:** [December 9, 2009, 4:25pm UTC](https://www.ruby-forum.com/t/validates-presence-of-file-fields/179968 "2009-12-09T16:25:41Z")

</div>

I can’t seem to get validates\_presence\_of to work with file fields. It keeps on reporting the field is empty whether I put a file in or not. Is there a way to validate whether a file has been uploaded?

---

## [Warning: while starting the apache server](https://www.ruby-forum.com/t/warning-while-starting-the-apache-server/180002)

<div class="topic-metadata">

**Author:** [@periyasamy](https://www.ruby-forum.com/u/periyasamy)\
**Replies:** 0\
**Last updated:** [December 9, 2009, 3:24pm UTC](https://www.ruby-forum.com/t/warning-while-starting-the-apache-server/180002 "2009-12-09T15:24:04Z")

</div>

Hi, When i start the apache server by using the command “service httpd start” on my centOS. Apache is started. But i am getting the warning as below, Starting httpd: Warning: DocumentRoot \[/root/enable/public\] does n…

---

## [Input/output error for spreadsheet(0.6.4.1) gem](https://www.ruby-forum.com/t/input-output-error-for-spreadsheet-0-6-4-1-gem/179983)

<div class="topic-metadata">

**Author:** [@dhaval\_parikh33](https://www.ruby-forum.com/u/dhaval_parikh33)\
**Replies:** 1\
**Last updated:** [December 9, 2009, 1:54pm UTC](https://www.ruby-forum.com/t/input-output-error-for-spreadsheet-0-6-4-1-gem/179983 "2009-12-09T13:54:00Z")

</div>

i’ve installed spreadsheet(0.6.4.1) and required it in one of my controllers. it works fine for some days and suddenly starts giving “Input/output error”. /usr/lib/ruby/gems/1.8/gems/spreadsheet-0.6.4.1/lib/spreadshee…

---

## [Routing Error when testing and using restful routes](https://www.ruby-forum.com/t/routing-error-when-testing-and-using-restful-routes/179987)

<div class="topic-metadata">

**Author:** [@kinunt](https://www.ruby-forum.com/u/kinunt)\
**Replies:** 2\
**Last updated:** [December 9, 2009, 10:45am UTC](https://www.ruby-forum.com/t/routing-error-when-testing-and-using-restful-routes/179987 "2009-12-09T10:45:44Z")

</div>

When testing I get this code I get the following error: test “should update proveedor” do put :update, :id =\> proveedores(:iberdrola).to\_param, :proveedor =\> {:fax =\> ‘943456578’} assert\_redirected\_to proveedor\_path(…

---

## [Rails start/stop without using mongrel](https://www.ruby-forum.com/t/rails-start-stop-without-using-mongrel/179954)

<div class="topic-metadata">

**Author:** [@periyasamy](https://www.ruby-forum.com/u/periyasamy)\
**Replies:** 1\
**Last updated:** [December 9, 2009, 10:30am UTC](https://www.ruby-forum.com/t/rails-start-stop-without-using-mongrel/179954 "2009-12-09T10:30:46Z")

</div>

Hi, I have to get rid of Mongrel and process the http requests directly from Tomcat/Apach. Is there any tool or do we have to handle in code?. How to run the rails application without using mongrel. Can you guys repl…

---

## [How to add partials through javascript](https://www.ruby-forum.com/t/how-to-add-partials-through-javascript/179985)

<div class="topic-metadata">

**Author:** [@antony\_4u](https://www.ruby-forum.com/u/antony_4u)\
**Replies:** 0\
**Last updated:** [December 9, 2009, 8:15am UTC](https://www.ruby-forum.com/t/how-to-add-partials-through-javascript/179985 "2009-12-09T08:15:27Z")

</div>

Is it possible to add partials through java-script. Want to add the partial dynamically while clicking + button. It want to add as a child to a div. any Idea ? Cheers, Antony

---

## [Undefined method \`last' for {"user\_engine"=\>:environment}:Ha](https://www.ruby-forum.com/t/undefined-method-last-for-user-engine-environment-ha/160482)

<div class="topic-metadata">

**Author:** [@mehdy](https://www.ruby-forum.com/u/mehdy)\
**Replies:** 2\
**Last updated:** [December 9, 2009, 6:55am UTC](https://www.ruby-forum.com/t/undefined-method-last-for-user-engine-environment-ha/160482 "2009-12-09T06:55:07Z")

</div>

\[root@localhost coupa-1.5\]# ruby -v ruby 1.8.5 (2006-08-25) \[i386-linux\] \[root@localhost coupa-1.5\]# gem -v 1.3.1 \[root@localhost coupa-1.5\]# gem list \*\*\* LOCAL GEMS \*\*\* actionmailer (2.2.2, 1.3.3) actionpack (2.…

---

## [Find with condition on association](https://www.ruby-forum.com/t/find-with-condition-on-association/179922)

<div class="topic-metadata">

**Author:** [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Replies:** 5\
**Last updated:** [December 9, 2009, 3:59am UTC](https://www.ruby-forum.com/t/find-with-condition-on-association/179922 "2009-12-09T03:59:29Z")

</div>

I don’t know why I can never find this active record find-related stuff when I google for it. It slays me over and over again and I keep having to do ugly things to get around it. If I have Articles and an article ha…

---

## [Using Authlogic, AuthenticatesMany, and Adding Accounts](https://www.ruby-forum.com/t/using-authlogic-authenticatesmany-and-adding-accounts/179965)

<div class="topic-metadata">

**Author:** [@scrozier](https://www.ruby-forum.com/u/scrozier)\
**Replies:** 0\
**Last updated:** [December 8, 2009, 9:50pm UTC](https://www.ruby-forum.com/t/using-authlogic-authenticatesmany-and-adding-accounts/179965 "2009-12-08T21:50:47Z")

</div>

I’ve read the following: http://rdoc.info/projects/binarylogic/authlogic (Module: Authlogic::AuthenticatesMany) And from what I understand Authlogic will support users that all belong to one account. I’m in the proc…

---

## [Filter chain halted](https://www.ruby-forum.com/t/filter-chain-halted/179959)

<div class="topic-metadata">

**Author:** [@carter](https://www.ruby-forum.com/u/carter)\
**Replies:** 0\
**Last updated:** [December 8, 2009, 8:25pm UTC](https://www.ruby-forum.com/t/filter-chain-halted/179959 "2009-12-08T20:25:40Z")

</div>

Hello,my application stops responding sometimes and I see this in the development log. What could be the problem? Redirected to http://localhost:3000/session/new Filter chain halted as \[#\<ActionController::Filters::C…

---

## [Finding duplicate data](https://www.ruby-forum.com/t/finding-duplicate-data/179950)

<div class="topic-metadata">

**Author:** [@trevoke](https://www.ruby-forum.com/u/trevoke)\
**Replies:** 3\
**Last updated:** [December 8, 2009, 6:22pm UTC](https://www.ruby-forum.com/t/finding-duplicate-data/179950 "2009-12-08T18:22:47Z")

</div>

Hello, I have a database with the following fields: id, created\_at, updated\_at, study\_date, user\_id, modality\_id, count In other words, a rather normal Rails database. I had some issues getting ‘study\_date’ to play n…

---

## [Best Practice: Using Gems that require model changes](https://www.ruby-forum.com/t/best-practice-using-gems-that-require-model-changes/179944)

<div class="topic-metadata">

**Author:** [@scrozier](https://www.ruby-forum.com/u/scrozier)\
**Replies:** 10\
**Last updated:** [December 8, 2009, 4:25pm UTC](https://www.ruby-forum.com/t/best-practice-using-gems-that-require-model-changes/179944 "2009-12-08T16:25:10Z")

</div>

In my particular example, I originally built my app with simple user authentication just to get it up and going. Since then, I’ve decided to use Authlogic. Authlogic requires a few changes to my user model, so my que…

---

## [Respond\_to takes either types or a block, never both](https://www.ruby-forum.com/t/respond-to-takes-either-types-or-a-block-never-both/179819)

<div class="topic-metadata">

**Author:** [@ksader](https://www.ruby-forum.com/u/ksader)\
**Replies:** 3\
**Last updated:** [December 8, 2009, 2:11pm UTC](https://www.ruby-forum.com/t/respond-to-takes-either-types-or-a-block-never-both/179819 "2009-12-08T14:11:36Z")

</div>

I have an application that runs ok, however running the rspec I receieve a multitude of similar errors like this: ArgumentError in ‘AccessControlTestController requesting html; I am logged in and Login not require…

---

## [Calling](https://www.ruby-forum.com/t/calling/179933)

<div class="topic-metadata">

**Author:** [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Replies:** 1\
**Last updated:** [December 8, 2009, 11:32am UTC](https://www.ruby-forum.com/t/calling/179933 "2009-12-08T11:32:20Z")

</div>

Guyz i am having a small problem, How can i call a function of application\_controller into my layout file… Any way … ?

---

## [Frontend and admin , best practice?](https://www.ruby-forum.com/t/frontend-and-admin-best-practice/179896)

<div class="topic-metadata">

**Author:** [@ialuronico](https://www.ruby-forum.com/u/ialuronico)\
**Replies:** 1\
**Last updated:** [December 8, 2009, 9:04am UTC](https://www.ruby-forum.com/t/frontend-and-admin-best-practice/179896 "2009-12-08T09:04:03Z")

</div>

Hi, I’m writing a small website (with restful authentication users) with a frontend and an administration. Wich is the best practice ? running 2 separate application (frontend and admin) sharing the same DB mix…

---

## [Problem of beginning zero params!](https://www.ruby-forum.com/t/problem-of-beginning-zero-params/179928)

<div class="topic-metadata">

**Author:** [@rubyernewbie](https://www.ruby-forum.com/u/rubyernewbie)\
**Replies:** 1\
**Last updated:** [December 8, 2009, 8:23am UTC](https://www.ruby-forum.com/t/problem-of-beginning-zero-params/179928 "2009-12-08T08:23:54Z")

</div>

when I deal with a params like stock number. localhost/?stock=000879 becomes localhost/?stock=879 it automatically chop the 000. so, is it a bug? and anyone has some solutions here?

---

## [Routing Error](https://www.ruby-forum.com/t/routing-error/179926)

<div class="topic-metadata">

**Author:** [@carter](https://www.ruby-forum.com/u/carter)\
**Replies:** 2\
**Last updated:** [December 8, 2009, 7:50am UTC](https://www.ruby-forum.com/t/routing-error/179926 "2009-12-08T07:50:30Z")

</div>

Hello, my application freezes a lot. I checked the development log file and I see this every time it freezes. ActionController::RoutingError (No route matches “/template05.css” with {:method=\>:get}): C:/Users/carter/…

---

## [Yml file](https://www.ruby-forum.com/t/yml-file/179921)

<div class="topic-metadata">

**Author:** [@priyadharsini](https://www.ruby-forum.com/u/priyadharsini)\
**Replies:** 2\
**Last updated:** [December 8, 2009, 5:52am UTC](https://www.ruby-forum.com/t/yml-file/179921 "2009-12-08T05:52:46Z")

</div>

Hi all, Can we place .yml file in public folder or need to place only in config folder? Please make me clear in this. Thanks in advance. Buvana

---

## [Different routes depending on params hash value](https://www.ruby-forum.com/t/different-routes-depending-on-params-hash-value/179900)

<div class="topic-metadata">

**Author:** [@kinunt](https://www.ruby-forum.com/u/kinunt)\
**Replies:** 2\
**Last updated:** [December 8, 2009, 5:51am UTC](https://www.ruby-forum.com/t/different-routes-depending-on-params-hash-value/179900 "2009-12-08T05:51:14Z")

</div>

Is it possible to route/call a different action depending on a value of the params hash? I have a form with a pair of radio buttons. I would like to call a different action depending on which radio button is selected.…

---

## [Functional Testing Anomoly](https://www.ruby-forum.com/t/functional-testing-anomoly/101293)

<div class="topic-metadata">

**Author:** [@Jeremy\_Friesen](https://www.ruby-forum.com/u/Jeremy_Friesen)\
**Replies:** 7\
**Last updated:** [December 8, 2009, 5:09am UTC](https://www.ruby-forum.com/t/functional-testing-anomoly/101293 "2009-12-08T05:09:12Z")

</div>

I have a test method (below). def test\_save\_failed post( :edit, :record =\> StatusChanger.invalid\_data\_hash) assert\_response :success assert\_template ‘edit’ assert assigns(:record) assert\_equal false, assigns(:recor…

---

## [AJAX error](https://www.ruby-forum.com/t/ajax-error/179802)

<div class="topic-metadata">

**Author:** [@carter](https://www.ruby-forum.com/u/carter)\
**Replies:** 5\
**Last updated:** [December 7, 2009, 11:40pm UTC](https://www.ruby-forum.com/t/ajax-error/179802 "2009-12-07T23:40:48Z")

</div>

Hello, I am new to AJAX and need help displaying a shopping cart using Ajax. I can display the cart in the sidebar fine if I just redirect to the same page, but the wanted to use AJAX to do this. I am getting some so…

---

## [Rails - liquid question pls help](https://www.ruby-forum.com/t/rails-liquid-question-pls-help/179909)

<div class="topic-metadata">

**Author:** [@sameera](https://www.ruby-forum.com/u/sameera)\
**Replies:** 0\
**Last updated:** [December 7, 2009, 10:31pm UTC](https://www.ruby-forum.com/t/rails-liquid-question-pls-help/179909 "2009-12-07T22:31:50Z")

</div>

Hi All I’m having problems with my liquid template to getting work here is my code in my view main.erb I have the liquid content \<%= Liquid::Template.parse(@html\_content).render ‘navigation\_links’ =\> @navigation\_li…

---

## [S it ok to define login\_as in test\_helper.rb ? and use it](https://www.ruby-forum.com/t/s-it-ok-to-define-login-as-in-test-helper-rb-and-use-it/179832)

<div class="topic-metadata">

**Author:** [@sanjanad](https://www.ruby-forum.com/u/sanjanad)\
**Replies:** 1\
**Last updated:** [December 7, 2009, 8:09pm UTC](https://www.ruby-forum.com/t/s-it-ok-to-define-login-as-in-test-helper-rb-and-use-it/179832 "2009-12-07T20:09:24Z")

</div>

is it ok if i define my login\_as in test\_helper.rb ??? def login\_as(admin) @request.session\[:admins\] = admin ? admins(admin).id : nil end and then use login\_as:sanj in my functional tests…it does not show any errors…

---

## [How do i check whether my functional tests are workin?](https://www.ruby-forum.com/t/how-do-i-check-whether-my-functional-tests-are-workin/179833)

<div class="topic-metadata">

**Author:** [@sanjanad](https://www.ruby-forum.com/u/sanjanad)\
**Replies:** 1\
**Last updated:** [December 7, 2009, 8:08pm UTC](https://www.ruby-forum.com/t/how-do-i-check-whether-my-functional-tests-are-workin/179833 "2009-12-07T20:08:23Z")

</div>

my tests are running with no errors… but how do i check whether the functional tests i wrote are working…i need please… require File.dirname(FILE) + ‘/…/test\_helper’ class BooksControllerTest \< ActionController::Test…

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

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