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 6730989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:28:29+00:00 2026-05-26T10:28:29+00:00

I currently have some haml code which reads as %span.flagb.flag-gb this builds me a

  • 0

I currently have some haml code which reads as

%span.flagb.flag-gb

this builds me a nice span which the classes:
flagB
flag-gb

(which puts a nice sprite on the page of the gb (great britian) flag

Now I dont want to hard code the gb I have the iso country code which I can access with a
=code

but I am so new I dont know about the best way of replacing the “gb” with the code value

Full code below as how i have it atm

- TZInfo::Country.all_codes.each do |code|
  %li
    %a(href='#')
      %span.flagb.flag-gb
      =code

only way I have managed it so far is using pure html

<span class='flagB flag-#{code'></span>

Thanks

  • 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-05-26T10:28:29+00:00Added an answer on May 26, 2026 at 10:28 am

    The .classname syntax is just a shorthand, you can do it the long way:

    %span{:class => "flagb flag-#{code}"}
    

    See the HAML reference on class and id attributes for more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have some code which grabs some JSON from a site. This is
I currently have some code which needs to perform multiple updates per user for
So I'm working on some HTML5 code using HAML and SASS. I currently have
I currently have some code which iv used to export a table from the
I currently have some code that will produce a crash dump when my application
I currently have some code that pulls down a list of users in a
I've been trying to implement unit testing and currently have some code that does
I'm tinkering with Silverlight 2.0. I have some images, which I currently have a
I'm using Zend_Search_Lucene, the PHP port of Java Lucene. I currently have some code
I currently have a table structure that looks something like this(some details omitted): ColumnName

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.