Ruby on Rails Thursday, May 19, 2016

On Fri, May 20, 2016 at 2:40 AM, Colin Law <clanlaw@gmail.com> wrote:
>
> Note that here you have put @student.user_id

<snip>

> Also note that her you have said student.user_id (no '@')
> In the code you posted initially it is @student, which is nil as you
> have not assigned a value to it.

Yes, I tried to different approach with @student I'm getting an error
of undefined 'user_id' and with student.user_id things work but in
abrupt manner.

And I figured out where I'm commit mistake.

Actually my index.html.erb has partial and that partial has sub-partial.

Index.html.erb
|--Partial File
|--- Partial File

And in both partial files, in order to access data i'm passing each loop i.e

<% @students.each do |student| %>
<% end %>

Now I deleted sub-partial and put all content in single partial file.

Index.html.erb
|--- Partial File

Now everything working fine.

--
Cheers!

Deepak Kumar Sharma
Guru Nanak Dev Engineering College
India!

Blog: http://deekysharma.wordpress.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+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/CALDHwN4qt72NXP%3DNOgwG0g3uvq2CYSddNdPqFMmYU_higri6fg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment