Rendering Partial from another Folder

16 views
Skip to first unread message

Giannakis Prime

unread,
Jul 15, 2013, 4:47:36 PM7/15/13
to rubyonra...@googlegroups.com
Hey Guys i'm New to Rails (3 weeks now) and i'm Trying to render a Partial from my app/views/pins to my layouts/_header (My Menu) in a Modal. Im Using Bootstrap.
So i render it with <%= render "pins/form" %> but i get an undefined method `model_name' for NilClass:Class.]
My Modal Looks Like This :

<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 id="myModalLabel">Modal header</h3> </div> <div class="modal-body"> <%= render 'pins/form' %> </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> <button class="btn btn-primary">Save changes</button> </div> </div>

I searched 2 days now for a possible solution but found nothing :(
Can anybody help me ?

Thanks,
Johnny

Hassan Schroeder

unread,
Jul 16, 2013, 4:27:27 PM7/16/13
to rubyonra...@googlegroups.com
On Mon, Jul 15, 2013 at 1:47 PM, Giannakis Prime <ad...@phoenix-prime.gr> wrote:

> So i render it with <%= render "pins/form" %> but i get an undefined method
> `model_name' for NilClass:Class.]

So find the object that 'model_name' is being called on and figure
out why it's nil.

--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

Colin Law

unread,
Jul 17, 2013, 2:46:01 AM7/17/13
to rubyonra...@googlegroups.com
On 15 July 2013 21:47, Giannakis Prime <ad...@phoenix-prime.gr> wrote:
> Hey Guys i'm New to Rails (3 weeks now) and i'm Trying to render a Partial
> from my app/views/pins to my layouts/_header (My Menu) in a Modal. Im Using
> Bootstrap.
> So i render it with <%= render "pins/form" %> but i get an undefined method
> `model_name' for NilClass:Class.]

If you look through the call stack that should have been displayed in
the server window then you should find it referencing one of your
lines of code. There you will find which object is nil.

Colin
Reply all
Reply to author
Forward
0 new messages