HAML – parameter with dash

HAML Syntax for the HTML5 Data Field: %div{ :data => {:id => ‘555’} } Now, I started messing around, and it looks like this only works with “data” — other tags need to be: %div{ “star-datas” => “hello!” } Your example: %body{:data => { :spy => ‘abcd’}}

How to remove unwanted indent from HAML’s pre tag

You need to use the #preserve helper to convert the newlines in the pre to newline entities, like so: %pre.code = preserve do :escaped <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html> <head></head> <body> <form> <input type=”text” name=”empID” /> <input type=”submit”/> </form> </body> </html> In the future, you’ll be able to nest filters, so … Read more

How to do data- attributes with Haml and Rails?

Try this: %a{“data-toggle-description-length” => “toggle_me_ajax”, href: “#”} OR %a{href: “#”, :data => {:toggle_description_length => “toggle_me_ajax”}} For more details refer here You can also use html2haml converter available online EDIT: As mentioned in comments there are a couple more syntaxes which would work %a{href: “#”, { “data-toggle-description-length”: “toggle_me_ajax” }} OR %a{href: “#”, { :”data-toggle-description-length” => “toggle_me_ajax” … Read more

Using layouts in HAML files independently of Rails

You’re mixing up two distinct Rails feature: partials (using render) and layouts (using yield). You can add a rails-like version of either (or both) of them to a Haml only program. Partials In a rails view, you can use render :partial_name to cause the file _partial_name.html.haml to be rendered at that point in the containing … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)