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

  • SEARCH
  • Home
  • 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 973717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:19:15+00:00 2026-05-16T03:19:15+00:00

Is there a way to append something to the query string with no value

  • 0

Is there a way to append something to the query string with no value set?

I would like to see this kind of URL being generated: http://local/things?magic.

What I’m looking for is when the user goes to http://local/other?magic then every URL in the generated page would contain magic in the end.

Following code is almost a solution but it gives me http://local/things?magic=. There is an extra = that I don’t want there.

def default_url_options(options)
    if params.has_key?("magic")
        { :magic => "" }
    end
end

Setting { :magic => nil } will remove the magic entirely from the generated URLs.

  • 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-16T03:19:15+00:00Added an answer on May 16, 2026 at 3:19 am

    Edited due to the changed question on the comment below:

    Ah I see.

    You could easily use the same URL for all devices and just separate by checking the request environment for HTTP_USER_AGENT.

    But if this distinction is not enough (I think it is enough for more than 80% of all cases) you could do the following:

    in config/routes.rb:

    map.with_options :prefix => '/m', :format => 'mobile' do |mobile|
      mobile.resources :apples
      mobile.resource :user
      mobile.connect #...
    end
    
    # generates
    # /m/apples
    # /m/apples/new
    # ...
    # /m/user
    # ... 
    

    I have not tested this, but maybe you will have to add a MIME type mapping for :format => ‘mobile’.

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

Sidebar

Related Questions

Is there a way instead of doing something like this: for (item in list){
Is there a way of appending source html into a DOMElement? Something like this:
I have a select SQL query which use parallelism, something like this INSERT/*+ APPEND
Is there a way to run some code on new objects? Something like this:
I'm trying to compose a dynamic URL, is there any easier way to append
Is there a best (see below) way to append two byte arrays in C#?
Is there way to set @include mixin(); to variable? I tried this @mixin bg-gradient($fallback,
Is there any way to define constants in prolog? I'd like to write something
in F#, array.append can join two arrays; is there a way to append 2
is there way how to get name ov event from Lambda expression like with

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.