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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:34:53+00:00 2026-05-29T05:34:53+00:00

Suggest me which of the following flow is efficient ? flow 1: Happy Flow:

  • 0

Suggest me which of the following flow is efficient ?

flow 1:
Happy Flow:
form_page —–(form submit)——> post_action
———-(success)————> redirect_to_success_page

Error Flow:
form_page —–(form submit)——> post_action
———-(failure)————> redirect with params to form_page
Note:
In this flow end user will see the params in the url except password
(But it looks ugly for me ).

So I changed the flow from redirect page to render page. I created
dynamic class in model that will act like active record object (It is
not a sub class to active record).
After modification I will be able to see the field values in the form
but not in the url params. So the flow will be like the following

Happy Flow:
form_page —–(form submit)——> post_action
———-(success)————> redirect_to_success_page

Error Flow:
form_page —–(form submit)——> post_action
———-(failure)————> render form_page (view))

Note:
In this flow the end user will not see the params in the url. But he
will see a different url instead of form_url url i.e we will see
‘post_action’ in the url because we are just rendering the
form_page view in post_action action. Right now when you refresh
the page i reset the values in object (but this can be changed if we
want the obj to be alive all the time)

Apart from this details if you want code I will paste here.

controller.rb
-------------
def form_page
@something = SomeName.new({:one=>'', :two => ''})
end
def post_action
@something = SomeName.new(params[:some_variable])
if success
 redirect_to success_url
else
 render :action => form_page
end
end

model.rb
--------
class SomeName
  def initialize(hash)
    hash.each do |k,v|
      self.instance_variable_set("@#{k}", v)
      self.class.send(:define_method, k, proc{self.instance_variable_get("@#{k}")})
      self.class.send(:define_method, "#{k}=", proc{|v| self.instance_variable_set("@#{k}", v)})
    end
  end
end


view:
-----

<% form_for :something, :url => {:action => 'post_action'} do |f| %>
<%= f.text_field :one %>
<%= f.text_field :two %>
<% end %>
  1. If you want more details, I will provide it.
  2. Is there any other way to hide url params ?

Thanks in Advance,
Arun.

  • 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-29T05:34:54+00:00Added an answer on May 29, 2026 at 5:34 am

    A classic practice in Rails is to have same url do display the form and validate the form (with GET method in the first case, POST or PUT in the second case). Use it with the second flow of your question: after an error, the url of the user has not changed after the error, and the parameters are not in the URL.

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

Sidebar

Related Questions

I'm using he following code the call a CFC which returns auto-suggest results through
I have the following code with urllib2 which prints HTTP Error 403: Forbidden but
I have seen a few posts which suggest using something like the following inside
Can Any one suggest me which is the better approach to work with NSInputStream.
Which do you suggest: data Direction = Left | Right type Direction = Bool
Which AMI would you suggest for CentOS 5.x 64-bit? There is quite a large
Which algorithms or data structures are used in auto-suggest features? It seems that edit-distance
Can any one suggest me a lightbox jquery which supports .avi file??
Can anyone suggest me good plugin for memory leakage which can be integrated in
Can some suggest a good a free memory profiling tool which will show memory

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.