On 9 December 2015 at 11:05, Anujeet Kaur <anujeet@smartshore.nl> wrote:
> Hello everyone, I am new to ruby, i'm facing issues in it.
> When i try to print id for object in loop, i get an error
>
> Here is my code
>
> def index
> @lists = List.all
> @lists.each do |list|
> raise list.id
The raise method raises an exception (but you are not calling it
correctly). to print the id you want
puts list.id
As a newcommer I suggest you work right through a good tutorial (such
as railstutorial.org, which is free to use online), that will show you
the basics of Ruby and Rails.
Colin
--
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+unsubscribe@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/CAL%3D0gLvBK4T-g3R8NHJOPFMf2aQgmo5u3_52f%3D5YU-qpHygVFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment