locals and partials

6 views
Skip to first unread message

liku

unread,
Jun 21, 2008, 8:43:17 AM6/21/08
to StaticMatic
hi there,
I'm trying to get partials with locals working. but somehow I am too
stupid to implement it...
i followed the exact instructions on the staticmatic-website:

this in my current file:
= partial('mypartial', :locals => { :title => 'My Title' })

than this under partials/mypartial.haml:
%h1 title

=> this always prints out "title" (and not "My Title")

i even tried:

%h1= title or %h1= @title, which seems to make more sense to me, but
still no luck.

haml (2.0.0)
staticmatic (0.9.4)

any pointers???

thanks a bunch!

Ryan McGeary

unread,
Jun 21, 2008, 10:04:32 AM6/21/08
to stati...@googlegroups.com
After trying your scenario, I found that there seems to be a problem with staticmatic 0.9.4, haml 2.0.0, and using partials.  Try this:

$ sudo gem uninstall staticmatic
$ sudo gem install -v0.9.3 staticmatic
$ sudo gem install -v1.8.2 haml
$ sudo gem uninstall -v2.0.0 haml

This will leave you with staticmatic 0.9.3 and haml 1.8.2, which should allow your scenario to work:

some_page.haml:
= partial("mypartial", :locals => { :title => "My Title" })

mypartial.haml:
%h1= title

I haven't yet investigated why the conflict between staticmatic 0.9.4 and haml 2.0.0 exists, even though staticmatic 0.9.4 is dependent on haml >=2.0.0.

-Ryan


Stephen Lumenta

unread,
Jun 21, 2008, 10:41:31 AM6/21/08
to stati...@googlegroups.com
thanks for checking it out, it works now.
I get a new error though, which might clarify my previous problems.

DEPRECATION WARNING:
The Haml :locals option is deprecated and will be removed in version 2.0.
Use the locals option for Haml::Engine#render instead.

thanks!

Ryan McGeary

unread,
Jun 21, 2008, 2:15:46 PM6/21/08
to stati...@googlegroups.com
Stephen,

Just ignore that warning for now.  I think that's caused by that version of staticmatic using a deprecated feature of Haml.  It doesn't affect anything.

-Ryan

Ryan McGeary

unread,
Jun 21, 2008, 2:18:08 PM6/21/08
to stati...@googlegroups.com
Just re-read what you wrote:

I get a new error though, which might clarify my previous problems.

Yes, quite likely if staticmatic 0.9.4 is still using that same feature on haml 2.0 and haml 2.0 removed the deprecated feature.

-Ryan
Reply all
Reply to author
Forward
0 new messages