Hobo / hobo

The web app builder for Rails (moved from tablatom/hobo)
http://hobocentral.net
103 stars 39 forks source link

dryml partial crashes app the second and later times it is rendered #50

Open dziesig opened 10 years ago

dziesig commented 10 years ago

I have had major dryml problems when trying to use partials written in dryml. Partials with the same functionality written in html work fine.

Refreshing the offending page from the sample app generates:

undefined method `appviews_front__f_dryml__907223664903458373_69925963162780' for #<#Class:0x00000003807138:0x0000000383b028>

The sample app renders a dryml partial from the front page which demonstrates the problem. It also renders a html partial from the hfront page; this does NOT crash.

The sample app is located at git@github.com:dziesig/dryml-partial-bug.git

iox commented 10 years ago

Hi Don,

I have spent some time trying to debug this, bit I haven't found the solution yet. Somehow the Dryml template engine does not enjoy using partial files.

Before spending more time on this, I wanted to ask you if you have tried this approach for Dryml partials:

partial.dryml:

<def tag="partial">
  <h1>This is a partial</h1>
</def>

index.dryml

<include src="partial"/>
<partial/>

This is useful to split large Dryml files, but I don't know if it will cover your needs. What do you think?

iox commented 10 years ago

More references to a similar partial issue: https://groups.google.com/forum/#!topic/hobousers/2zv9LxpzDJI

dziesig commented 10 years ago

Hi Ignatio,

It took me a long time to get back to the partial problem. Most of my partials are used to keep the dryml files at a managable size, so I tried your suggestion and it works fine (for all of the places where I have made the change).

Now I can translate all the remaining html files I had to use so that I could use partials back to dryml.

Thanks for the hint.

Don

Hi Don,

I have spent some time trying to debug this, bit I haven't found the solution yet. Somehow the Dryml template engine does not enjoy using partial files.

Before spending more time on this, I wanted to ask you if you have tried this approach for Dryml partials:

partial.dryml:

|

This is a partial

|

index.dryml

|

|

This is useful to split large Dryml files, but I don't know if it will cover your needs. What do you think?

iox commented 10 years ago

I'm glad the workaround is useful for you Don.

I'm going to leave this open as low priority, without a milestone set.

dziesig commented 10 years ago

Hi Ignacio,

Well, I hit the bug again, this time indirectly. I just added the following code to index.dryml (enclosed in and after a javascript function that loads a google map (successfully)).

When 0 < mode > 3 (i.e. no partials are rendered) the code works fine.
If mode is set so one of the partials is rendered, it crashes the second time the page is rendered (just like before).

There is another path in the program that reaches the same javascript code via ajax (without hitting dryml) which works correctly.

Back to the drawing board :-( .

Don Ziesig

On 03/20/2014 05:36 AM, Ignacio Huerta wrote:

I'm glad the workaround is useful for you Don.

I'm going to leave this open as low priority, without a milestone set.

— Reply to this email directly or view it on GitHub https://github.com/Hobo/hobo/issues/50#issuecomment-38148484.

iox commented 10 years ago

Hi Don,

I'm afraid that Github removed the code from your comment, so I can't reproduce it. Could you try again pasting it directly through the Github interface? (https://github.com/Hobo/hobo/issues/50#issuecomment-38275915)

In this link you can see how to format "fenced code blocks": https://help.github.com/articles/github-flavored-markdown.

Alternatively, just email the code to my personal email :).

Regards, Ignacio

iox commented 10 years ago

Moving up in priority: we should be able to fix this!

owendall commented 10 years ago

Thanks for that, Ignacio. On Jan 3, 2014 1:18 PM, "Ignacio Huerta" notifications@github.com wrote:

Hi Don,

I have spent some time trying to debug this, bit I haven't found the solution yet. Somehow the Dryml template engine does not enjoy using partial files.

Before spending more time on this, I wanted to ask you if you have tried this approach for Dryml partials:

partial.dryml:

This is a partial

index.dryml

This is useful to split large Dryml files, but I don't know if it will cover your needs. What do you think?

— Reply to this email directly or view it on GitHubhttps://github.com/Hobo/hobo/issues/50#issuecomment-31541903 .

enwood commented 10 years ago

Hi Ignacio. I, too, seem to have hit this very issue in Hobo 2.0.1. On a re-render (or refresh) of a DRYML page that calls a partial, I get the same crash. First time through is perfect.

  <content-body:>
        ...
        <%= render :partial => '/packages/payments', :locals => { :package => @package } %> 
        ...
  </content-body:>
</submit-page>

NoMethodError - undefined method _app_views_packages__payments_erb__2530908954951846704_70312386648420' for #<#Class:0x007fe5bbd072c8:0x007fe5c1f0b258>: () Users/tgriffin/.rvm/gems/ruby-1.9.3-p545/bundler/gems/hobo-cda5c09aafa8/dryml/lib/dryml/template_environment.rb:642:in method_missing' actionpack (3.2.12) lib/action_view/template.rb:145:in `block in render'