Ruby on Rails Tuesday, April 1, 2014

On 1 April 2014 06:11, Karthikeyan A K <77minds@gmail.com> wrote:
> Hello people,
>
> I am developing an app with Rails 4.0.x and I have a strange bug in its
> view. Say I have a partial like this
>
> %p= @bject,name # would work perfectly

Does using @object,name also work (not @bject which you have written above)?

>
> = render @object.friends # It won't fetch this relation

What do you mean it will not fetch the relation? What is the error message?

>
> %p= @object,name # It would say can't find name for nil class

Then @object is nil. Perhaps you should be using @bject.

Note that when posting code it is better to copy/paste then there will
be no confusion about what the code actually is.

>
> For some reason the above stuff happens. However in the rails console, all
> would work fine. Kinda confused.
>
> Would be great if any one could throw light on this. Don' know if this is a
> Rails bug where state of instance variable gets forgotten after some time.

My experience is that bugs in compilers/frameworks/OSs are very rarely
the cause of problems. 99.999% it is one's own code that is at fault.

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%3D0gLtqbxQr719tqtxd_CO6%2BSPRDJRt-KzVooZRL33UsaR%3D-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment