I have an odd problem while trying to use a simple rjs. _test.rjs : page.alert "test" test.rhtml: <script><%=render_partial(''test'')%></script> When I am attempting to view controller/test the page comes as if it was a text file. So i am actually seeing: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> ... <script> alert("test"); </script> Any ideas? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060716/1e573c58/attachment.html
Bogdan Ionescu wrote:> I have an odd problem while trying to use a simple rjs. > > _test.rjs : page.alert "test" > > test.rhtml: <script><%=render_partial(''test'')%></script> > > When I am attempting to view controller/test the page comes as if it was > a > text file. > So i am actually seeing: > > <!DOCTYPE html > PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html> > ... > <script> > alert("test"); > </script> > > Any ideas?I''m pretty sure it''s because you''re rjs is called _test.rjs? It should just be called test.rjs. -Ben Lisbakken -- Posted via http://www.ruby-forum.com/.
Ben Lisbakken wrote:> Bogdan Ionescu wrote: >> I have an odd problem while trying to use a simple rjs. >> >> _test.rjs : page.alert "test" >> >> test.rhtml: <script><%=render_partial(''test'')%></script> >> >> When I am attempting to view controller/test the page comes as if it was >> a >> text file. >> So i am actually seeing: >> >> <!DOCTYPE html >> PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> >> <html> >> ... >> <script> >> alert("test"); >> </script> >> >> Any ideas? > > I''m pretty sure it''s because you''re rjs is called _test.rjs? It should > just be called test.rjs. > > -Ben Lisbakkenthat and also you don''t need to render the partial test. As soon as you call the action test, it automatically calls the controller action, any rjs file called test.rjs, and any rhtml file called test.rhtml. So no need to render, the alert in test.rjs will go as soon as u go to www.____.___/controller/test -- Posted via http://www.ruby-forum.com/.
That still does not explain why it does not do it properly. And renaming _test.rjs to test.rjs (and removing render_partial) did not help. In fact, test.rjs is not being included at all. On 7/17/06, Ben Lisbakken <lisbakke@gmail.com> wrote:> > Ben Lisbakken wrote: > > Bogdan Ionescu wrote: > >> I have an odd problem while trying to use a simple rjs. > >> > >> _test.rjs : page.alert "test" > >> > >> test.rhtml: <script><%=render_partial(''test'')%></script> > >> > >> When I am attempting to view controller/test the page comes as if it > was > >> a > >> text file. > >> So i am actually seeing: > >> > >> <!DOCTYPE html > >> PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > >> <html> > >> ... > >> <script> > >> alert("test"); > >> </script> > >> > >> Any ideas? > > > > I''m pretty sure it''s because you''re rjs is called _test.rjs? It should > > just be called test.rjs. > > > > -Ben Lisbakken > > > that and also you don''t need to render the partial test. As soon as you > call the action test, it automatically calls the controller action, any > rjs file called test.rjs, and any rhtml file called test.rhtml. So no > need to render, the alert in test.rjs will go as soon as u go to > www.____.___/controller/test > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060717/ad593309/attachment.html