Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Render and parse problems when using with <script/> templates #98

stackus opened this Issue May 31, 2011 · 4 comments


None yet
2 participants

stackus commented May 31, 2011

When a validated form is put into a <script/> template the extra <script> var ... {...}; </script> closes the original script tag early.


%script{:type => "text/html"}
  = form_for Person.new :validate => true do |f|
    = f.text_field :name

What is finally rendered is a script tag surrounding another script tag. Could the gem be changed to allow the user to choose to have the script contents be sent to content_for and the symbol of their choosing?


bcardarella commented May 31, 2011

That's an interesting proposal. I'm not opposed to this but I'm not certain how the API would look. Maybe something like this:

= form_for @person, :validate => :person do |f|
  = f.text_field :name

The idea is to pass something other than true. If that is the case then the user would have to manually do:

= content_for :person


stackus commented May 31, 2011

After posting the issue I wanted to see if what I asked was possible so I got into the gem source and monkey patched in some code and that's what I ended up doing.


bcardarella commented May 31, 2011

Ok, I think API I proposed makes sense. I'll add it. Thanks for the feed back :)

@stackus stackus closed this Jun 1, 2011

@bcardarella bcardarella reopened this Jun 1, 2011


bcardarella commented Jun 2, 2011

There you go :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment