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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:21:47+00:00 2026-05-23T14:21:47+00:00

I am using Devise for authentication in my website. I want the user be

  • 0

I am using Devise for authentication in my website.
I want the user be able to post in the text area if he/she is signed in, if not he’ll type what he wants to post in the textarea and when he click on post it pops up a sign-in dialog where user sign-in/sign-up and then it automatically post his comment in the text area to the website.

I’m not sure if I’m using the right logic, but I have the post button to post the comment if user signed-in, otherwise do nothing and javascript opens up the login-dialog. The login/sing-up works but I figure out how to post the message automatically after that.

This is my code for the button:

 <% if user_signed_in? %>
    <%= f.submit :value => t(:submit_comment_text), :class => "submit-button" %>
 <% else %>
    <input class="submit-button" id="comment_submit_nlogged"  value="Post!"/>
 <% end %>

The first part works fine, but the second part the dialog opens up and the user sign in, but it refreshes the page and I loose whatever user typed in the text-area.
I tried to get the content of the text-area through the params variable, but when devise gets called the params for text area goes away and they get replaced by devise params.

Any idea how I can get this working?

  • 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-23T14:21:48+00:00Added an answer on May 23, 2026 at 2:21 pm

    You can save the text area in a session variable like

    • pass the value in the params when the user signs in/signs up
    • in the controller, save it in a session variable( session[:text_area] = params[:text_area]
    • then after sign in or sign up, you will be redirected to the comment page and you can
      repopulate the @comment object in the controller method using session[:text_area] and remove it.

    You can read about Rails Sessions here
    There can also use cookies(if the textarea content is small) or HTML localStorage( if your browser supports it)

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

Sidebar

Related Questions

I have already created a User Model using devise, but I now want to
I'm using Devise for authentication for my site. An unauthenticated visitor should be able
I'm using Devise for user authentication and basic authentication. Let's say I have defined
I'm Using Devise in my Rails 3.0.9 application for User Authentication. As I wanted
I'm using Devise for authentication, but I'm using two user models, Buyer and Seller.
I am using the devise gem for authentication and have the following before_filter in
Using the current rails 2 I want users to be able to create an
I'm using Devise for authentication in my Rails app. I'd like to eager load
I have a rails app that is using Devise, with a User model, no
I am using devise for my authentication system and on the main page I

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.