Note that there are some explanatory texts on larger screens.

plurals
  1. PORuby on rails/Javascript widget
    primarykey
    data
    text
    <p>So here is my point, i tried to follow some tutorial and read all of the references in the end from <a href="http://8raystech.com/2011/11/28/how-to-create-embeddable-widgets-with-rails" rel="nofollow">http://8raystech.com/2011/11/28/how-to-create-embeddable-widgets-with-rails</a></p> <p>I spent almost 2 days searching for the little mistake I obviously made somewhere since I'm new to ruby on rails. I think it might be a route error since when I inspect elements via Chrome, i see the following error: <strong>EDIT:</strong></p> <pre><code>"GET http://localhost:3000/widget 500 (Internal Server Error)" </code></pre> <p>I tried many things on it desperately but here is my current code:</p> <p>My widget controller looks like this: (widget_controller.rb)</p> <pre><code>class WidgetController &lt; ApplicationController def show @content = render_to_string(:partial =&gt; 'widget/embed', :layout =&gt; false) end end </code></pre> <p>My view using javascript (show.erb.html)</p> <pre><code>(function() { document.write(&lt;%= @content.to_json %&gt;) })() </code></pre> <p>The partial is not really important i think but here is an example: (_embed.erb.html)</p> <pre><code>&lt;style&gt;...&lt;/style&gt; &lt;div class="widget-communication"&gt; &lt;div&gt;Bla bla bla&lt;/div&gt; ... &lt;/div&gt; </code></pre> <p>and for the last, in the routes.rb</p> <pre><code>... match 'widget', to: 'widget#show' ... </code></pre> <p>So I tested in local to load my widget using this:</p> <pre><code>&lt;script src="http://localhost:3000/widget" type="text/javascript"&gt;&lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload