Now giving error:
undefined method `key' for #<Question:0x007fdff26b7798>

In Question model:
 before_validation :capitalize_first_words

    def capitalize_first_words
      [:question, :correct_ans_1, :correct_ans_2, :correct_ans_3].each 
do |key|

          self.key = self.key.gsub(/^(\W*?[a-z])/) { |m| m.upcase } if 
!self.key.blank?
      end
    end

Am I missing something really quite simple?

Thanks

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/7ab2093213f91856ff4da26b60ca355b%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to