If statement with form field select in rails

Posted by Elliot on Stack Overflow See other posts from Stack Overflow or by Elliot
Published on 2010-03-24T02:47:25Z Indexed on 2010/03/24 2:53 UTC
Read the original article Hit count: 332

Filed under:

I'm trying put an if statement directly into a select field in rails, with no success.

Here is what I've tried:

    <%= f.select (:book_id,{ 
    if @a!=1
            "Harry Potter", 1,
    end
    if @b!=2
            "Lord of the Rings", 2,
    end
    end %>`

Any ideas?

© Stack Overflow or respective owner

Related posts about ruby-on-rails