Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9119891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:30:14+00:00 2026-06-17T05:30:14+00:00

I need to be using double quotes on my attributes due to a Javascript

  • 0

I need to be using double quotes on my attributes due to a Javascript framework issue I am having, and I have tried setting the Haml::Template.options hash as the documentation recommends when using Rails, however isn’t taking affect for the ‘assets’ folder, regardless of where I am setting the option. Note, it is working on normal ActionView templates being rendered by Rails controllers, but not in templates I have under {Rails.root}/app/assets/javascripts/templates/*.html.haml

This is what I have in {Rails.root}/config/initializers/haml.rb:

Haml::Template.options[:attr_wrapper] = '"'

# Adds the ability to use HAML templates in the asset pipeline for use with
# Batman.js partials
Rails.application.assets.register_mime_type 'text/html', '.html'
Rails.application.assets.register_engine '.haml', Tilt::HamlTemplate

I’ve also tried changing the register_engine to use Haml::Engine and Haml::Template, which both render, but still don’t take my options I set above.

How do I set the Haml options for rendering in the asset pipeline? It seems like I need to pass in options for the Sprocket engine?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:30:15+00:00Added an answer on June 17, 2026 at 5:30 am

    I found the solution here.
    It’s all about monkey patching.

    I prefer this variation, as it keeps the options already set for Haml::Template.
    Put this at the end of your haml initializer.

    class Tilt::HamlTemplate
      def prepare
        options = @options.merge(:filename => eval_file, :line => line)
        # Use same options as Haml::Template
        options = options.merge Haml::Template.options
        @engine = ::Haml::Engine.new(data, options)
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to replace all double quotes to single quotes using mysql query. How
I have 2 double quotes that need to be replaced by a single double
I need to replace all double quotes to single quotes using jquery. How I
I need to write a Double value in a numeric cell using a specific
I need to do: I am using the normal auto-fill function in Excel (double
I have an XML file which I need to parse using PHP and send
I have a directory full of log files that I need to rotate using
I want to remove all double quotes using regex in CSV file if its
I am using codeigniter php MVC framework to develop a web application. I have
How do I replace two double quotes into single one using jQuery? For example:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.