similar to: REST vs. render vs. redirect_to w.r.t. create error messages, efficiency and the desired URL

Displaying 20 results from an estimated 11000 matches similar to: "REST vs. render vs. redirect_to w.r.t. create error messages, efficiency and the desired URL"

2006 Apr 26
3
catch all error for incorrect urls etc
Hi, I am changing a very standard old school website to rails. When I make the change to rails, all of the old urls will not be valid. If a person has a bookmark to an old web page I would like them to be directed to the front page of the new website www.domain.com. How do I do this? Do I do something in routes.rb? Thanks, Peter
2006 Jul 03
1
flash[:notice] followed by render
Hi, Sometimes I see action code like def my_action flash[:notice] = "Flash notice" render end It is even in DHH''s new World of Resources slide show page 22. With this use of flash before render, the user will see the flash for the next two visible displays. Am I missing something? Thanks, Peter
2006 Jul 07
5
Can a route require POST or GET? / REST problem with routing
Hi, A store front a customer wants to GET /product/5/show. But for the application this is really GET /cart_item/new/5 or even better /cart_item/new?cart_item[product_id]=5 When the customer clicks add_to_cart they POST /product/5/show so that the url doesn''t confuse the user when any validation errors occur. But for the applicaiton this should be POST
2005 Dec 23
1
render or redirect_to??
When would I use a render and when would I use a redirect_to? It seems that a redirect_to would be so much more common, but there has been an emphasis on rendering in rails John McClain Senior Software Engineer TCS Healthcare jmcclain-RI2jYlfFOOy2dUpmj6OxPQC/G2K4zDHf@public.gmane.org (530)886-1700x235 "Skepticism is the first step toward truth"
2008 Feb 28
2
redirect_to or render
Hey, a newbie here. Can someone please give me a brief explanation whats the difference between the redirect_to method and the render method and when should I use one instead of the other ? thnx alot ! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send
2007 Dec 03
0
Re: how to use render & redirect_to togethe
On Dec 3, 2007 8:37 AM, Jason Roelofs <jameskilton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > On Dec 3, 2007 8:24 AM, Advait Bellur <advait.bellur-/E1597aS9LQxFYw1CcD5bw@public.gmane.org> wrote: > > > > > Hi, > > > > I needed to know a way or method of using render and reditect_to > > methods. > > At present using them both is giving me
2006 Apr 17
2
Understanding when flash gets reset (render vs. redirect_to)
All, I have a controller action that will do a different "render (:action)" call depending on whether or not data is valid. When the data is invalid - I set a flash element to hold a message. However, when I post back to this controller action and have valid data, I still have the flash element set, which I don''t want. I believe this is because I did a render from the
2006 Apr 13
0
redirect_to or link_to mapped url. any other way than "../../smth"?
Hi all, I''ve got my urls mapped so that http://myapp/url is the same as http://myapp/start/show/url. Is there any way to use "redirect_to" and "link_to" in this case? Currently I just use redirect_to("../@url") but perhaps there''s some way to make it properly, with :action etc. sabon -------------- next part -------------- An HTML attachment was
2006 Apr 03
3
render :partial + redirect_to :controller
This is of course disallowed, which I discovered only after nearly completing my spanking new ajaxified UI. What is the motivation behind this, and what is the best workaround? This UI does a scriptaculous drag-and-drop of items from a first div (div1) over to a second div (div2), which triggers the contents of div2 to be updated to reflect the drop. No prob, thus far. But then the
2006 Mar 30
4
redirect_to("url") with post?
Is there a Rails-friendly way to redirect_to an url and post some parameters with that? I''ve tried: redirect_to("http://whatever.com", { ''postme'' => ''this'' }) redirect_to("http://whatever.com", :post => { ''postme'' => ''this'' }) redirect_to("http://whatever.com", :options
2006 Apr 26
10
save new model with child model
Hi, I am having a problem saving a new model that has an associated child model. If a new ticket is being created and will have one comment to go with it then I tried this in my action @ticket = Ticket.new(params[:ticket]) @comment = Comment.new(params[:comment]) @ticket.comments << @comment if @ticket.save @notice = "Ticket added. Thanks for
2006 Jul 06
0
redirect_to in IE6
I''ve scoured through the forum and I haven''t found anyone else talking about this problem. The login to my app directs authenticated users to a home page using redirect_to. This works fine with firefox but for some reason IE6 has a problem with. I have checked session info and that is just fine but instead of redirecting to the specified page IE6 redisplays the login page. As I
2006 Jul 03
1
Model Relations, Creating, Errors and stuff
Hi, I''ve searched the Agile.. book and tried google etc. but my main problem is not being able to think of keywords. I''m trying to save something with user info, and then further info if they are staff in a one-to-one relationship. I can do this all fine and good. def create @user = User.new(params[:user]) @staff_member = StaffMember.new(params[:staff_member])
2007 Feb 15
0
301 instead of 302 on redirect_to - RESTful
All this works on my dev machine (mongrel_rails) which makes it hard to debug. The deploy machine runs lighttpd 1.4.13 and rails 1.2.2. This is how it lookes: POST model/1 (_method PUT) 180.160.211.126 host.dk - [15/Feb/2007:16:05:53 +0100] "POST /model/6 HTTP/1.1" 301 0 "http://host.dk/model/6;edit?" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.1)
2007 Jun 22
1
nested rest URL => passing param from select
Hi, I''m trying to create a select box with an onchange event. When onchange is fired, I want to redirect to a nested rest url. The problem is that I don''t know how to pass the selected value to the url: <select id="category" onchange=" <%= remote_function(:url => category_articles_path(selected value?) ) %> "> Any suggestions? -- Posted
2006 Mar 14
7
Single form w/ relationships: how do I integrate it?
OK - I know this has been asked before, but I cannot find it in the archives. Forgive me if I''m creating more noise than I should. I want to know the easiest way to deal with this scenario: I have articles. I have categories for the articles. On the form where you write an article, there needs to be a free-form field to entire the category. The create() method will build the
2006 May 31
5
Sharing code between some controllers? Staying DRY
Hi, I have four controllers: one for the store front and three for the store admin. In each controller I have copied and pasted exactly the same code. It is a method called redirect_to() to override Action Controller''s redirect_to(). Copy and paste is bad. I can think of two options but I don''t know how Rails will feel about them. Option 1: Can I create an intermediate
2006 Mar 20
4
Ajax.Request w/standard redirect doesn''t render
I am doing an Ajax call in my page to a controller method like so: new Ajax.Request(''<%= url_for(:action => "target_list_add" )%>'', { asynchronous:true });" In my controller method "target_list_add", I do something and then I say: redirect_to( :action => ''target_list_upload'', :layout => false ) I know for certain
2006 Jun 22
1
Change of controller name and SEO issue
Hi, I developed an app with cetain controller names. Now that the app is catching up I''m trying to change the controller names to be better aligned with the business. This is what I have now. http://localhost/foo/method1 http://localhost/foo/method2 http://localhost/foo/method2/a http://localhost/foo/method2/a/b http://localhost/foo/method2/a/b/c http://localhost/foo/method3 I would
2006 Jan 19
7
validates_numericality_of positive integer
Hi, What is the simplest way to validate a positive integer? validates_numericality_of :foo, :integer_only => true how do I add the positive part? Do I need another validation statement for pattern matching or do I have to write a validate() funciton for my model? Thanks, Peter