On 22/05/07, SydneyStephen <[EMAIL PROTECTED]> wrote: > > After some months of battling with this environment I am wondering > whether I have chosen the right tools for the job at hand. Rails > likes to do things in an ordered, but clunky, fashion - you execute an > action and Rails then looks for an *.rhtml file with the same name as > the action. If you do anything out of sequence, Rails throws away the > instance variables and you can no longer reference the information you > need. The standard Rails way of doing things is ok for the behind-the- > scenes administrative stuff but i would not want to expose a customer > to this, so i need complete control over what is displayed, and > where... > > So I have a series of functions which reside in the layout sidebar (so > that i keep the administrative actions neatly off to the side, while > the main focus of attention remains in full view). So, when the > customer first goes to the site the product list is displayed in the > main view and there is a login and a register button in the sidebar. > > If the customer registers or logs in, this all happens in the sidebar, > leaving the products display intact. In order to ensure that the > products remain in the display I have to persuade Rails not to look > for a register.html or login.rhtml file by using the render :action or > redirect_to_action statements. > > But this causes Rails to throw away things I need - like the @customer > instance variables (if i use redirect), or the @product instance > variables (if i use render...) > > Am I being too ambitious with Rails in trying to provide a clean, > managed, user interface? It seems to me that Rails is better suited > as a back-end grungy file maintenance application - or am i being too > harsh?
You appear to be fundamentally misunderstanding the nature of HTTP. If you're going the redirect route (which makes sense if the login isn't an AJAX request), you need to add the customer id to the session so that the customer can be retrieved after the redirect. You could learn Smalltalk and try Seaside, I suppose, but that might take a bit longer than simply learning the meaning of the phrase 'stateless protocol' and applying that understanding. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
