ruby-on-rails

replace id with name in collection_select

In my application i have a collection_select on my members table, the members table only contains id's. It has an user_id, project_id, role_id, and so on. I want show the members name in the collection_select. But i only have the user_id in the members table, how can i show the names from the user table as options? <%= collection_selec...

Deployment Strategy using Nginx and Passenger

Hello, I need help with setting up nginx and passenger on two separate machines. Can anyone point me in the right direction? I've already finished setting up my nginx and now that I need to install passenger, Ive reached this road block and I'm not sure how to proceed. Thanks! ...

Rails 2.3 nested attributes issue

I'm running into to a issue with a nested form which I'm sure should be easily solved, yet I can't find a way around it Basically I have the following relationship event has_many :contacts => through :event_contacts the nested form works perfectly as long as I'm creating new contacts each time. If I include a drop down to allow sel...

output_buffer is null on helper spec

I am trying to test the html block method inside the rails helper: def dashboard_widget(header, &proc) concat('<div class="dashboard-widget">') etc end The code works perfectly in the development environment, but the following test is failed: it "should be created" do helper.dashboard_widget('My widget') do "hello world" ...

authlogic shared session

Hi, all. I have shared between 2 sites ActiveRecord Session Store. On the first i've created UserSession object. Is there any way to restore UserSession on the second if i know session_id? ...

Invoke action to send email in ruby on rails

I am attempting to send an email to the present borrower of a book. I've created an ActionMailer called ReturnRequestMailer which has a method called please_return. class ReturnRequestMailer < ActionMailer::Base def please_return(book_loan) subject 'Book Return Request' recipients book_loan.person.email from 'andr...

selecting page elements with webrat

There is a list of products (html table). Each row has got product name and ends with 'add to cart' button. How to add 2 'coffee' and 3 'tea' in the cart from webrat? Corresponding html: <tr class="odd"> <td><img src="/images/menu_items_images/7/PICT0020_thumb.jpg" /></td> <td>cofee</td> <td>americano</td> <td>1...

Rails: named_scope, lambda and blocks

Hi, I thought the following two were equivalent: named_scope :admin, lambda { |company_id| {:conditions => ['company_id = ?', company_id]} } named_scope :admin, lambda do |company_id| {:conditions => ['company_id = ?', company_id]} end but Ruby is complaining: ArgumentError: tried to create Proc object without a block Any idea...

Pure OpenID Authentication

Possible Duplicate: OpenID support for Ruby on Rails application What's the best way to implement a pure OpenID authentication in Ruby On Rails? ...

RESTful Media Sharing API

Does anyone know of any good free media sharing sites like twitpic.com, but not for just twitter? It needs to have a good RESTful API. Preferably hosts video and audio as well as images. Kinda like mobypicture.com, but with a RESTful API. ...

using authlogic to auto create users bypassing explicit user registeration

Hello, I'm wondering how to go about using Authlogic to auto register a user who chooses to use open id. Right now they have to register first before being able to login in, even if they choose open id, but I'd prefer if they could just login directly provided I get all the necessary details from the open id provider. But I'm not sure ...

How do I get twitter/friendfeed like home urls in rails?

I want to be able to have twitter like friendly urls like http://twitter.com/username. How to pull this off in rails? ...

Populating a Select with Model Data in Rails

I feel the need to apologize for asking such a simplistic question, but I'm getting increasingly frustrated with the Rails Guides. I'm sure they answer my question, but they don't provide enough context for me to really understand how to apply what they're giving me. Nor is Google much help, though I may just be searching the wrong terms...

quick rails named routes question

In my view I specify a named route like this: show.html.erb -> seo_path(:id => "45") Now in my routes I define like so: routes.rb -> map.seo "/pages/:id/:permalink", :controller => "pages", :action => "show" Below is the error message I am getting. Apparently the diff is the id, although I don't know why. Update: I am getting t...

Difference between CookieStore Sessions and Encrypted Cookies in Ruby On Rails

I was wondering whether there is any difference between a session and an encrypted cookie (configured to expire as the session cookie does). Aren't they the exact same thing? Or Rails provides extra security for sessions? ...

Multilingual ruby on rails app

I want to have Greek support in my rails app for the messages/flashes etc. I took a quick look at the I18n framework but it seems like a lot of configuration for something so simple. I thing that there should be a very easy way to do something like this but ( apparently ) I don't know it. If anyone would be willing to help me I'll be gla...

can Amazon be used to offload server of static files for a Ruby on Rails app, but still support the app's authentication & authorization?

Hi, Can one of the Amazon services (their S3 data service, or otherwise) be used to offload server of static files for a Ruby on Rails app, but still support the app's authentication & authorization? That is such that when the user browser downloaded the initial HTML for one page of the Ruby on Rails application, when it went back fo...

Why not use Cookies for Authentication instead of sessions?

I would like to persist the user authentication between user sessions (basically a "remind me" by default). Sessions expire while cookies persist: why should I use a session for authentication and then another different cookie for the "remind me"? Can't I simply store a cookie whith a token and use it for both authentication and persis...

Why does Ruby on Rails use http://0.0.0.0:3000 instead of http://localhost:3000 ?

I am very new to Ruby on Rails so when I tried to follow the official "Getting Started" ruby on rails tutorial, I was a bit disappointed because it went wrong very quickly. Basically it said : …navigate to http://localhost:3000. You should see Rails’ default information page. But when I follow the instructions, I get => Rails 2.3...

Ruby on Rails before_destroy causing NameError

I am trying to implement before_destroy on a model. While I am following this before_destroy example I either receive a NameError or end up with something which doesn't do the before_destroy. What's wrong with my syntax? class Person < ActiveRecord::Base has_many :book_loans, :order => 'return_date desc' has_many :books, :through =...