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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:33:59+00:00 2026-06-13T03:33:59+00:00

I want users to test my application without registering for an account. In order

  • 0

I want users to test my application without registering for an account. In order to do this I thought about including a link in my commercial site that would make a POST to my application site (http://app/login using devise) sending a fixed user and password, and thus creating a session. I tried with link_to with :method => ‘post’ but I dont know how to send the params in the POST body! Any suggestions?

I’m trying with this

link_to 'Blah', {:params => 'asdf'}, {:method => :post, :href => 'http://localhost:3001/login'}
  • 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-13T03:34:01+00:00Added an answer on June 13, 2026 at 3:34 am

    In order to pass the query params, you need to put them in as part of the URL like you would for a GET request. Like so:

    <%= link_to "Click Here", "/login?username=testuser&password=moojuice", :method => :post %>
    

    or alternatively if you are using Rails route helpers

    <%= link_to "Click here", login_path(:username => "testuser", :password => "moojuice"), :method => :post %>
    

    I’m not exactly sure based on the original question if you will be using this link in the same Rails application as the one you are logging into. If you aren’t, there is one other slight gotcha. When posting from an external site, Rails is going to most likely ignore your request because you will be missing the CSRF token that Rails automatically generates when you loads a page. In order to accomplish this, you’re going to have to put a protect_from_forgery method call in the controller that handles your login. Assuming your /login route maps to the SessionsController action create:

    class SessionsController < ApplicationController
      protect_from_forgery :except => [:create] # Need this to ignore CSRF token
      def create
        # Login logic
      end
    end
    

    That being said, I wouldn’t suggest removing the CSRF token because this will make your application less secure. I would suggest just implementing a special action in your SessionsController that just logs them in to their own Session like so:

    class SessionsController < ApplicationController
    
      def create
        # Login logic
      end
    
      def demo_account
        # Logic to create session for demo account
      end
    end
    

    This way you can just forget about a link that does the POST request and just have a GET route that maps /demo_login to SessionsController‘s *demo_account* action. This would additionally allow this link to be used anywhere as opposed to just in your application (like in an email as one of the previous commenters @allaire suggested). But if you want it to work from a link in your Rails application, then just ignore the part of my answer about the CSRF token.

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

Sidebar

Related Questions

I want to write a simple chat application (for test use). The users and
I want to test Add new item activity in my application. When user fills
I want to test my part of code that returns the users password question.
I want users to receive 'points' for completing various tasks in my application -
I have been reading a lot about test-driven development and decided that I want
I want to use nose to test an application that I am writing using
My application shows several items whereby users can search. I want to place a
During deployment of a web application (in test environment) on customer site we encountered
I am using QUnit and JQuery and want to test user interface of my
I want to populate my database with test data my user and profile models

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.