Alright, I'm still green with ruby, so excuse my ignorance..![]()
I've got a number of columns in a user table that I want to loop through..
I'm doing something like:
I'm getting an error says "undefined method `c'"Code:<% cols = %w(phone_number aim_sn msn_sn) cols.each do |c| if !empty?(@user.c) %> <span><%= @user.c %></span> <% end end %>
how do I get it so it uses c dynamically, instead of as the character c??
Or if you think my code is absolutely silly, let me know how i _should_ be doing it..
Thanks





Bookmarks