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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:28:01+00:00 2026-05-13T13:28:01+00:00

This is possibly a newbie question, but I’m not sure what terms to search

  • 0

This is possibly a newbie question, but I’m not sure what terms to search for.

Say I have a CUSTOMER object, and I want to send a MESSAGE to that customer.

What I would do first is add a SENDMESSAGE action on the CUSTOMER controller, which builds the message object. (Assume this is the right thing to do?)

In this instance however, rather than actually send the message from within this action, I need to forward to the edit view of the MESSAGE to capture the body text etc.

The question: I want to do this without persisting the object. I want to build the object here and then hand it over to another view for completion.

def sendmessage
    @message = Message.new
    @message.title = 'WIBBLE'
    @message.thecustomer = self
    @message.save    
    respond_to do |format|
      format.html { redirect_to(edit_message_path(@ message)) }
      format.xml  { render :xml => @ message }
    end
end

Maybe my question boils down to, what is the ‘rails way’ to cache parameters and objects across requests and multiple screens.

Happy to be pointed towards Web URLs as I expect this is simple.

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-13T13:28:02+00:00Added an answer on May 13, 2026 at 1:28 pm

    The standard way to persist data across requests when building Web applications is to use the HTTP session. Rails makes an implicit session hash available for this purpose. It’s used like this:

    session[:message] = @message #store
    @message = session[:message] #retrieve
    

    You can also use the Rails flash session wrapper for passing information from the current action to the next. It’s usually used for storing text to be displayed in the UI, but you can use it for persisting any object:

    flash[:message] = @message #store
    @message = flash[:message] #retrieve
    

    In both cases, the objects that you’re storing must be serializable. Note that by default Rails stores session data in an encrypted cookie on the client; consider it a strong hint that storing a lot of data in the session is frowned upon in the Rails world.

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

Sidebar

Related Questions

There is another possibly related question on this but it didn't have answers and
This may be a newbie question. I've used javascript for years but have only
Probably this is a newbie question :) But I have some Flash games built
Sorry if this is a newbie question. I have searched but found nothing... Using
I'm wondering if there's a solution to this: (possibly not, but you never know!)
This is quite possibly a very stupid question but I've tried searching for and
This is probably a newbie question, but is it possible to add a sprite
I know this is probably a newbie question, but is it possible to do
This is probably a very newbie question but what I'm trying to do is
I am an Objective-C newbie, who still does not have a Mac, but still

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.