NoMethodError – undefined method `render_to_string’ for #<#:0x007f95255e3c08>:


Do I need to include anything special in order to call
render_to_string from the view?  When I try to do something like this
in my rhtml template:

<%= render_to_string(:partial => "user_description") %>

I get the error:

undefined method `render_to_string' for #<#<Class:0xb76e9134>:

followed by an excerpt from my template.  Do I have something wrong
with the syntax?


I think I have found the answer-- apparently in the view templates,
you just call "render" and not "render_to_string".  The explanation
for this is probably that in the view you always want to render to a
string, but I'm not sure.


How to append  a partial in div?

in view file:
 <%  @partial = render(:partial=> 'pages/content/call_text_phone', :formats=>[:html]) %>
in view file
<script type="text/javascript">


 $('#content_form_div').append("<%= j @partial%>");


I am Senior Software Engineer. I love reading, writing, sharing,developing, hiking, movies, trips, mountains, brooks, hills etc.

Tagged with: , ,
Posted in Html, JQuery, Ruby Little Codes

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: