# Rails

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

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

---

## [Net/http set content-type for images](https://www.ruby-forum.com/t/net-http-set-content-type-for-images/189745)

<div class="topic-metadata">

**Author:** [@kim](https://www.ruby-forum.com/u/kim)\
**Replies:** 6\
**Last updated:** [June 8, 2010, 2:07am UTC](https://www.ruby-forum.com/t/net-http-set-content-type-for-images/189745 "2010-06-08T02:07:09Z")

</div>

I need to pull an image from a URL (I have permission) that is a .jpg. I know I need to set the content-type to ‘image/jpeg’, but not sure where to do that at. result = Net::HTTP.get\_response(URI.parse(‘http:// link\_…

---

## [Noob question about irb](https://www.ruby-forum.com/t/noob-question-about-irb/189794)

<div class="topic-metadata">

**Author:** [@radu\_puspana](https://www.ruby-forum.com/u/radu_puspana)\
**Replies:** 2\
**Last updated:** [June 7, 2010, 11:51pm UTC](https://www.ruby-forum.com/t/noob-question-about-irb/189794 "2010-06-07T23:51:21Z")

</div>

hey guys, can you spare some time? i have this crazy thing with ruby. when i enter irb and hit the return key, instead to run interactive ruby the shell gives me this : radup@radup:~$ irb Directory doc already exis…

---

## [Visual Effect: insert new stuff, then slide open](https://www.ruby-forum.com/t/visual-effect-insert-new-stuff-then-slide-open/189683)

<div class="topic-metadata">

**Author:** [@kampers](https://www.ruby-forum.com/u/kampers)\
**Replies:** 3\
**Last updated:** [June 7, 2010, 8:50pm UTC](https://www.ruby-forum.com/t/visual-effect-insert-new-stuff-then-slide-open/189683 "2010-06-07T20:50:58Z")

</div>

Hi guys: Thanks for your help so far - think I’ve progressed pretty far down the Rails front but I think I’m getting stuck, maybe you can help me out: I’ve got a twitter like app where I’m trying to display new tweets…

---

## [Help with a daft question....:-)](https://www.ruby-forum.com/t/help-with-a-daft-question/189786)

<div class="topic-metadata">

**Author:** [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Replies:** 3\
**Last updated:** [June 7, 2010, 7:54pm UTC](https://www.ruby-forum.com/t/help-with-a-daft-question/189786 "2010-06-07T19:54:12Z")

</div>

Hello, I am hoping somwone can help with this… Basically I have a website and I want to display a list of users currently using the site, prior to someone logging in. In a sense, it is a way for people to view a profi…

---

## [Redirect\_to issue](https://www.ruby-forum.com/t/redirect-to-issue/189787)

<div class="topic-metadata">

**Author:** [@Mlle](https://www.ruby-forum.com/u/Mlle)\
**Replies:** 1\
**Last updated:** [June 7, 2010, 7:10pm UTC](https://www.ruby-forum.com/t/redirect-to-issue/189787 "2010-06-07T19:10:16Z")

</div>

I’m having trouble getting redirect\_to to work. I have a search controller with the following code: if params\[:format\].include?("map") source = params\[:format\].split('\_').second redirect\_to :controller =\> "geodata…

---

## [REE and ruby PATH problem](https://www.ruby-forum.com/t/ree-and-ruby-path-problem/189756)

<div class="topic-metadata">

**Author:** [@pakothawade](https://www.ruby-forum.com/u/pakothawade)\
**Replies:** 10\
**Last updated:** [June 7, 2010, 5:06pm UTC](https://www.ruby-forum.com/t/ree-and-ruby-path-problem/189756 "2010-06-07T17:06:44Z")

</div>

I have ruby normal edition installed in /usr/bin REE in /opt/ruby-enterprise-1.8.7-2010.01/bin I have all my application gems installed in /opt/ruby- enterprise-1.8.7-2010.01/bin but still when i run any gem related …

---

## [Can we configure CanCan on Devise](https://www.ruby-forum.com/t/can-we-configure-cancan-on-devise/189778)

<div class="topic-metadata">

**Author:** [@sivakumar](https://www.ruby-forum.com/u/sivakumar)\
**Replies:** 0\
**Last updated:** [June 7, 2010, 4:54pm UTC](https://www.ruby-forum.com/t/can-we-configure-cancan-on-devise/189778 "2010-06-07T16:54:51Z")

</div>

Hello guys, This is my quick question. Can we configure CanCan on Devise? If so, please gimme the outlines on it. Any reference site is much appreciated. Thank you Siva

---

## [Problems with basic Rails](https://www.ruby-forum.com/t/problems-with-basic-rails/189775)

<div class="topic-metadata">

**Author:** [@punkaruby](https://www.ruby-forum.com/u/punkaruby)\
**Replies:** 3\
**Last updated:** [June 7, 2010, 4:44pm UTC](https://www.ruby-forum.com/t/problems-with-basic-rails/189775 "2010-06-07T16:44:29Z")

</div>

Hi all, I’m a newbie I’ve installed RoR on win 7 and this is script\\about About your application’s environment Ruby version 1.9.1 (i386-mingw32) RubyGems version 1.3.7 Rack version …

---

## [Rake gems:freeze GEM=pdf-writer not working on MAC](https://www.ruby-forum.com/t/rake-gems-freeze-gem-pdf-writer-not-working-on-mac/189565)

<div class="topic-metadata">

**Author:** [@gandhi-tush](https://www.ruby-forum.com/u/gandhi-tush)\
**Replies:** 7\
**Last updated:** [June 7, 2010, 3:33pm UTC](https://www.ruby-forum.com/t/rake-gems-freeze-gem-pdf-writer-not-working-on-mac/189565 "2010-06-07T15:33:01Z")

</div>

Hi, I am using MAC 10.6 OS. I want to freeze the my application gems so that it will nor required to install again when I go to production. For freezing of gems I am going through the tutorial “http://gemsonrails.ru…

---

## [Logging bestpractice in production](https://www.ruby-forum.com/t/logging-bestpractice-in-production/189770)

<div class="topic-metadata">

**Author:** [@luckydeepak](https://www.ruby-forum.com/u/luckydeepak)\
**Replies:** 0\
**Last updated:** [June 7, 2010, 1:45pm UTC](https://www.ruby-forum.com/t/logging-bestpractice-in-production/189770 "2010-06-07T13:45:56Z")

</div>

hi, In production i wanted to reduce the loglevel, but when i set the log\_level to :warn, rails stops logging the request, params. completion time etc. The code below works, but had some questions: is it ok to dup …

---

## [Unable to set expiry date on cookies](https://www.ruby-forum.com/t/unable-to-set-expiry-date-on-cookies/189768)

<div class="topic-metadata">

**Author:** [@fipa](https://www.ruby-forum.com/u/fipa)\
**Replies:** 4\
**Last updated:** [June 7, 2010, 1:36pm UTC](https://www.ruby-forum.com/t/unable-to-set-expiry-date-on-cookies/189768 "2010-06-07T13:36:15Z")

</div>

cookies\[:user\_info\] = {:value =\> “whatever”, :expires =\> 30.days.from\_now } When I check in the browser, the cookie will expire “at end of session” Oo What’s happening? How to set the cookie’s date then? Thanks :slig…

---

## [Contacts gem to save imported contacts](https://www.ruby-forum.com/t/contacts-gem-to-save-imported-contacts/189766)

<div class="topic-metadata">

**Author:** [@swetha](https://www.ruby-forum.com/u/swetha)\
**Replies:** 0\
**Last updated:** [June 7, 2010, 12:05pm UTC](https://www.ruby-forum.com/t/contacts-gem-to-save-imported-contacts/189766 "2010-06-07T12:05:50Z")

</div>

Hi, I am working on an application ,where user can login to their gmail/ yahoo/hotmail to grab contacts from them. I am done with getting them from respective accounts but i need help with saving them to my applicati…

---

## [Mongrel / webrick process not shutting down properly in dev env. after ^C](https://www.ruby-forum.com/t/mongrel-webrick-process-not-shutting-down-properly-in-dev-env-after-c/154461)

<div class="topic-metadata">

**Author:** [@pixelhandler](https://www.ruby-forum.com/u/pixelhandler)\
**Replies:** 2\
**Last updated:** [June 7, 2010, 11:56am UTC](https://www.ruby-forum.com/t/mongrel-webrick-process-not-shutting-down-properly-in-dev-env-after-c/154461 "2010-06-07T11:56:27Z")

</div>

I’m going thru a tutorial, Agile Web D. with Rails (v3)… I’m having an issue on my mac with the web server not quitting properly, mongrel / webrick process not shutting down properly in dev env. after ^C in terminal w…

---

## [Undefined method \`tab' for radiant](https://www.ruby-forum.com/t/undefined-method-tab-for-radiant/188841)

<div class="topic-metadata">

**Author:** [@smit\_shah](https://www.ruby-forum.com/u/smit_shah)\
**Replies:** 3\
**Last updated:** [June 7, 2010, 11:27am UTC](https://www.ruby-forum.com/t/undefined-method-tab-for-radiant/188841 "2010-06-07T11:27:11Z")

</div>

Hi all… I am new to radiant cms. I have tried to install blog and liveblog extensions. But in both cases I got the following error. rake aborted! undefined method \`tab’ for #BlogExtension:0xb6dc23e4 and rake aborte…

---

## [\<button type="button"](https://www.ruby-forum.com/t/button-type-button/189630)

<div class="topic-metadata">

**Author:** [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Replies:** 6\
**Last updated:** [June 7, 2010, 11:00am UTC](https://www.ruby-forum.com/t/button-type-button/189630 "2010-06-07T11:00:13Z")

</div>

Hi I would like to construct a button like Add And I used the helper button\_to\_remote for this like \<%= button\_to\_remote(“Add”, { :url =\> some\_url(@id), :condition =\> “check\_valid()”, :with=\> “‘ids=’+user\_ids”}, …

---

## [Running passenger + nginx](https://www.ruby-forum.com/t/running-passenger-nginx/189720)

<div class="topic-metadata">

**Author:** [@ct9a](https://www.ruby-forum.com/u/ct9a)\
**Replies:** 3\
**Last updated:** [June 7, 2010, 10:12am UTC](https://www.ruby-forum.com/t/running-passenger-nginx/189720 "2010-06-07T10:12:06Z")

</div>

hi guys, Assuming I made some changes to the source code. My production environment runs on passenger and nginx. How do I restart passenger and nginx with minimal downtime? Surely I can’t do a “w” on the terminal bec…

---

## [How to test login action in a controller?](https://www.ruby-forum.com/t/how-to-test-login-action-in-a-controller/189762)

<div class="topic-metadata">

**Author:** [@SSSSSSS\_S\_SSSSS\_SSS](https://www.ruby-forum.com/u/SSSSSSS_S_SSSSS_SSS)\
**Replies:** 0\
**Last updated:** [June 7, 2010, 10:09am UTC](https://www.ruby-forum.com/t/how-to-test-login-action-in-a-controller/189762 "2010-06-07T10:09:20Z")

</div>

My login page has a login form with three fields:login,password,and image verification code,now how to test it? require File.dirname(FILE) + “/…/spec\_helper” http://www.kirkbushell.com/articles/testing-using-rspec-p…

---

## [How to embed html to other site](https://www.ruby-forum.com/t/how-to-embed-html-to-other-site/189636)

<div class="topic-metadata">

**Author:** [@soesan01](https://www.ruby-forum.com/u/soesan01)\
**Replies:** 3\
**Last updated:** [June 7, 2010, 10:05am UTC](https://www.ruby-forum.com/t/how-to-embed-html-to-other-site/189636 "2010-06-07T10:05:09Z")

</div>

Hi, Is there an example code to create embed code (from my site) so I can embed my html to other site? for example, I want to embed my html to other site. Here is the sample embed code for example: test\<script ty…

---

## [Deployment of rails application using Passenger](https://www.ruby-forum.com/t/deployment-of-rails-application-using-passenger/189759)

<div class="topic-metadata">

**Author:** [@gandhi-tush](https://www.ruby-forum.com/u/gandhi-tush)\
**Replies:** 0\
**Last updated:** [June 7, 2010, 9:58am UTC](https://www.ruby-forum.com/t/deployment-of-rails-application-using-passenger/189759 "2010-06-07T09:58:47Z")

</div>

Hi, I new to rails deployment. Can anyone tell me how to do the rails application deployment using passenger? Anyone point me to the correct URL which will have everything regarding the deployment. Thanks, Tushar

---

## [Model validation giving problem](https://www.ruby-forum.com/t/model-validation-giving-problem/189757)

<div class="topic-metadata">

**Author:** [@gandhi-tush](https://www.ruby-forum.com/u/gandhi-tush)\
**Replies:** 3\
**Last updated:** [June 7, 2010, 9:28am UTC](https://www.ruby-forum.com/t/model-validation-giving-problem/189757 "2010-06-07T09:28:56Z")

</div>

Hi, I have a member registration form which takes a “Name”, “Login”, “Password”, “Confirm Password” and “Location”. In the user model I have added the validation validate\_uniqueness\_of :login, validate\_presence\_of :…

---

## [How do you update HABTM relationships or create](https://www.ruby-forum.com/t/how-do-you-update-habtm-relationships-or-create/189700)

<div class="topic-metadata">

**Author:** [@ali](https://www.ruby-forum.com/u/ali)\
**Replies:** 6\
**Last updated:** [June 7, 2010, 6:07am UTC](https://www.ruby-forum.com/t/how-do-you-update-habtm-relationships-or-create/189700 "2010-06-07T06:07:34Z")

</div>

Hi, I have a User model with a HABTM relation to a Role model and vice versa. So There’s a roles\_users table that references :user and :role. I’m using formtastic, and in the user.edit.html.erb I have a line that out…

---

## [Disable erubis xss escaping](https://www.ruby-forum.com/t/disable-erubis-xss-escaping/189743)

<div class="topic-metadata">

**Author:** [@arvias](https://www.ruby-forum.com/u/arvias)\
**Replies:** 0\
**Last updated:** [June 7, 2010, 12:17am UTC](https://www.ruby-forum.com/t/disable-erubis-xss-escaping/189743 "2010-06-07T00:17:36Z")

</div>

Hi. Is there a way to disable erubis auto escaping? I understand the implications, and in our project everything in sanitized during input. On the other hand, we use a lot of: \<%= “#{translate something} value #{tran…

---

## [What kind of Ruby / Erb is allowed inside HAML's :javascript](https://www.ruby-forum.com/t/what-kind-of-ruby-erb-is-allowed-inside-hamls-javascript/189629)

<div class="topic-metadata">

**Author:** [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Replies:** 12\
**Last updated:** [June 6, 2010, 11:44pm UTC](https://www.ruby-forum.com/t/what-kind-of-ruby-erb-is-allowed-inside-hamls-javascript/189629 "2010-06-06T23:44:40Z")

</div>

It seems that inside of HAML’s :javascript filter, no Ruby code is allowed, not even a comment. So this is NOT allowed: :javascript 1.upto(10) do |i| :javascript -# just a comment not to show to public (somebody …

---

## [XMLHttpRequest and render :js not working](https://www.ruby-forum.com/t/xmlhttprequest-and-render-js-not-working/189741)

<div class="topic-metadata">

**Author:** [@fipa](https://www.ruby-forum.com/u/fipa)\
**Replies:** 0\
**Last updated:** [June 6, 2010, 10:17pm UTC](https://www.ruby-forum.com/t/xmlhttprequest-and-render-js-not-working/189741 "2010-06-06T22:17:28Z")

</div>

Hi, So I uploaded a file to my server using an XMLHttpRequest and I wanted to notify the client of the url of the uploaded file. So in my app on the server side, I use for testing purposes: render :js =\> “alert(‘File…

---

## [Require](https://www.ruby-forum.com/t/require/197046)

<div class="topic-metadata">

**Author:** [@Srinivas\_G](https://www.ruby-forum.com/u/Srinivas_G)\
**Replies:** 2\
**Last updated:** [June 6, 2010, 8:04pm UTC](https://www.ruby-forum.com/t/require/197046 "2010-06-06T20:04:09Z")

</div>

In Ruby there is a command called ‘require’. Explain what this command means and write an example of how it is used to include a Ruby Gem in a file.

---

## [Flash not deleting with Redis/Memcache store](https://www.ruby-forum.com/t/flash-not-deleting-with-redis-memcache-store/189420)

<div class="topic-metadata">

**Author:** [@Jon\_Brisbin](https://www.ruby-forum.com/u/Jon_Brisbin)\
**Replies:** 1\
**Last updated:** [June 6, 2010, 8:02pm UTC](https://www.ruby-forum.com/t/flash-not-deleting-with-redis-memcache-store/189420 "2010-06-06T20:02:59Z")

</div>

I’m a recent convert to Rails and I’m working on a new project using Rails 2.3 (I’ll probably upgrade at some point when Rails 3 is in production and had a chance to bake the .0 bugs out). I’m going to use Redis anywa…

---

## [Query](https://www.ruby-forum.com/t/query/189687)

<div class="topic-metadata">

**Author:** [@Srinivas\_G](https://www.ruby-forum.com/u/Srinivas_G)\
**Replies:** 6\
**Last updated:** [June 6, 2010, 7:44pm UTC](https://www.ruby-forum.com/t/query/189687 "2010-06-06T19:44:56Z")

</div>

‘Teacher’ is a table in a database. Based on that information, explain what the following query is searching for in the table: Teacher.find(:all, :condition =\> { :grade =\> 9…12})

---

## ['.new' command](https://www.ruby-forum.com/t/new-command/189689)

<div class="topic-metadata">

**Author:** [@Srinivas\_G](https://www.ruby-forum.com/u/Srinivas_G)\
**Replies:** 2\
**Last updated:** [June 6, 2010, 7:40pm UTC](https://www.ruby-forum.com/t/new-command/189689 "2010-06-06T19:40:47Z")

</div>

Using the ‘.new’ command, add a teacher to the data table with a name of ‘Sam’.

---

## [Problems testing a method to clone associations](https://www.ruby-forum.com/t/problems-testing-a-method-to-clone-associations/189735)

<div class="topic-metadata">

**Author:** [@ginty](https://www.ruby-forum.com/u/ginty)\
**Replies:** 0\
**Last updated:** [June 6, 2010, 7:40pm UTC](https://www.ruby-forum.com/t/problems-testing-a-method-to-clone-associations/189735 "2010-06-06T19:40:44Z")

</div>

I’ve got a method to ‘deep clone’ an object, basically to clone it plus all of its associations. Here is the code: def deep\_clone clone = self.clone %w\[phone\_numbers addresses websites emails\].each do |assoc| clone…

---

## [REE & application frozen gems](https://www.ruby-forum.com/t/ree-application-frozen-gems/189684)

<div class="topic-metadata">

**Author:** [@pakothawade](https://www.ruby-forum.com/u/pakothawade)\
**Replies:** 5\
**Last updated:** [June 6, 2010, 6:00pm UTC](https://www.ruby-forum.com/t/ree-application-frozen-gems/189684 "2010-06-06T18:00:04Z")

</div>

I have the following versions of ruby installed in my production env. ubuntu ~ \> /usr/bin/ruby -v ruby 1.8.7 (2010-01-10 patchlevel 249) \[x86\_64-linux\] ubuntu ~ \> /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby -v ruby…

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

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