Hi All! Following code is working perfectly on Ruby IDE, can anyone tell me how will it works on Ruby on Rails. Because when i run it using ruby on rails, it is not displaying anything and also no errors. Even I have properly include rubygems and ruby_parser. Even Rails server stops working <% require "rubygems" require "ruby_parser" sexpfaulty1 = RubyParser.new.parse(File.read("faulty_0.rb")) %> <%= sexpfaulty1 %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 11, 8:08 am, Michel Jhon <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi All! > > Following code is working perfectly on Ruby IDE, can anyone tell me how > will it works on Ruby on Rails. Because when i run it using ruby on > rails, it is not displaying anything and also no errors. Even I have > properly include rubygems and ruby_parser. Even Rails server stops > working > > <% > require "rubygems" > require "ruby_parser" > > sexpfaulty1 = RubyParser.new.parse(File.read("faulty_0.rb")) > > %> >Why stick this in the view? Have you checked what the current directory is when this executes> <%= sexpfaulty1 %>You should escape this (with h) as if it contains invalid markup the browser might get confused. Fred> -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
<% require "rubygems" require "ruby_parser" ast = RubyParser.new.parse(File.read("faulty_0.rb")) print ast %> <%=h sexpfaulty1 %> This code have the same previous problem. However, "print ast" showing sexp(AST) in background, but not on the web browser. So definitly, there is some escape problem. I tried "<%=h" but no effect yet. /Michal Frederick Cheung wrote:> On Jun 11, 8:08�am, Michel Jhon <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> require "ruby_parser" >> >> sexpfaulty1 = RubyParser.new.parse(File.read("faulty_0.rb")) >> >> %> >> > Why stick this in the view? Have you checked what the current > directory is when this executes >> <%= sexpfaulty1 %> > You should escape this (with h) as if it contains invalid markup the > browser might get confused. > > Fred-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---