Forum: Ruby on Rails Need help making code more rails like!

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eed3ca2591560a2dd91222d9b62f882d?d=identicon&s=25 Ryan Prins (Guest)
on 2006-04-25 07:14
(Received via mailing list)
Hi all, I've been a PHP programmer for many years and I've recently
picked
up ruby and rails and am loving it! However, I'm still learning the
"rails
way" of doing things and I've got a block of code that I think could use
a
face lift. Any help, tips, suggestions, you can offer in making it more
rails-like is greatly appreciated. The only thing that I need for sure
is
the call to check_box_tag(). Thanks in advance for any assistance!

The following code is contained within a partial (excuse the formatting
mess):

<% for course in @courses -%>
        <%= course.name %>:
        <% if course.id.to_s == session[:current_course].to_s -%>
            <%= check_box_tag 'post_courses[]', course.id, true,
{:disabled
=> 'disabled'}  %><br />
        <% else -%>
            <%= check_box_tag 'post_courses[]', course.id %><br />
        <% end -%>
    <% end -%>
This topic is locked and can not be replied to.