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

The Archive Base Latest Questions

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

I implemented a standard Rails (and RESTful) process to CRUD an object. The only

  • 0

I implemented a standard Rails (and RESTful) process to CRUD an object.

The only customization (or “configuration over convention”) I need is the following:

After a standard edit form, instead of showing the object, I show its “preview” (which simply is the action “show” with some adjustments in the view and with “object.status = preview”) at this point I need to allow the user to “confirm” or “save” this previewed object with a simple button.
Like if the user where submitting again the edit form (or the same object) but without having to see it again. Just hitting a “Confirm” button.

(In the update action I check if the object.status is “preview” and if so I consider it confirmed and I show a confirmation message instead of the preview).

My only missing piece is the “Confirm” button in the “show” view to PUT the @object.

How can I implement it?

PS: I know the best practice is to show the preview in the edit view (just like in stackoverflow.com) but in my app the design is very important so I need to provide the most close to reality as possible preview.

  • 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:17:54+00:00Added an answer on May 26, 2026 at 10:17 am

    You probably don’t need another action, just another view. Basically the flow is something like this:

    1. User lands on the edit page. The form is rendered. They edit it and submit it…
    2. The Update action is called. No “previewed” parameter is available, so the “preview” view is rendered instead of actually saving the form.
    3. The preview shows the preview (like show), but it also has a copy of the form with the fields hidden (via CSS) and an additional hidden value called “previewed” with a value of “1”.
    4. When the user clicks “Confirm” the form is submitted right back to the update action that then sees the “previewed” parameter and actually saves the object and redirects to the show page.

    Here’s the controller code, since it’s the most complicated piece:

    # controller
    def show
      @widget = Widget.new
    end
    
    def edit
      @widget = Widget.find(params[:id])
    end
    
    def update
      previewed = params.delete(:previewed)
    
      @widget = Widget.find(params[:id])
      @widget.attributes = params
    
      if @widget.valid? && previewed
        @widget.save!
        redirect_to widget_path(@widget), :notice => 'Yay'
      elsif @widget.valid?
        render :preview
      else
        render :edit
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented a standard UITableViewController . I have made only some rows in
I'm writing an app for Blackberry that was originally implemented in standard J2ME. The
I have a form with most of its functionality implemented using standard TAction. I
I have implemented few payment websites using PayPal Standard, PayPal Website Pro, PayPal Express
I'm looking for a standard dual-map structure - is there one implemented in std/boost/another
Has anybody seen a GP implemented with online learning rather than the standard offline
The ECMA standard defines a hidden, internal property [[Call]] , which, if implemented, mean
GNU gcc 4.3 partially supports the upcoming c++0x standard: among the implemented features the
I have successfully implemented a standard WCF service bound to MSMQ using the net.msmq
hey guys i need to implement a standard encryption decryption logic across an entire

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.