Muskalek wrote in post #1158351:
 That is because your name method is called recursively - the `return
 name + ""` is calling `name` once again and again and again... If you
 want to access raw attributes from database on ActiveRecord models, you
 can always use `self[:name]`.

 It might be convenient for you to use ruby interpolations in a method
 like `describe`. The following is equivalent to your method (you don't
 need return either - the last thing evaluated is always returned from a
 method):

> def describe
>    "#{name}#{email}#{mobile}#{category}#{other}"
> end
>
 I don't understand the idea behind `+ ""`. If you want convert any 
value
 to string, it is convention in ruby to call #to_s method on it. If you
 use anything in an interpolation, ruby will call #to_s on this object
 for you.

 MichaƂ.

Thank you very much for your help sir :)

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/fe88dd62e5398a8f6f049dcc84a106c5%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to