HAML: Migrating Slowly?

I have two separate questions:

First question: I want to migrate an app that uses rhtml and rjs to
haml. To do this effectively, I was hoping I could call my rhtml
partials from haml. So far, no success. Anybody do this successfully?

= render(:partial => ‘foo’)

gives me the `find_template_extension_for’: No rhtml, rxml, rjs or
delegate template found

Second question: Is there any way to intersperse Ruby into template
other than in an = code injector. For example, is there a better way
to write this?

= “Hello, #{@person.first_name} #{@person.last_name}”

I’m not saying this is any worse than a sea of <%= %>. I was just
wondering whether this is the best approach.


That’s an extremely odd error. We use mixed-type partials all the time
in our production code. So, I’m not sure what might be causing that
error. In fact, when you call render, your directly referencing
ActionView::Base.render… something that HAML is not really involved
with (except as being one of the delegate renderers).

What happens if you are more explicit with your call?

= render :partial => “controller/foo.rhtml”

Does that do anything different?

Also, I tend to do this in your example

= @person.full_name

Hope this helps.


Different but not better. Does this help any?

action_view/partials.rb:125:in instance_variable_get':@tag_cloud.rhtml’ is not allowed as an instance variable name

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs