On Mon, 2009-08-10 at 13:58 -0700, djolley wrote:
> > The params hash get passed from the view to the controller.
> 
> Really?  I'm definitely thinking the other way around. Let's 
> think about this for a minute.

OK.

> In the URL box of my browser I enter 'http://
> my_host/members/update/15' and press enter.  I would expect this
> request to be routed to the update action of the members controller
> and I would expect there to be an :id=>'15' entry available in params
> for that action to use along with an :action=>'update' entry and
> a :controller=>'members' entry.  

That is correct.  All three 'entries' are members of the params hash.  I
should have worded my statement more carefully.  The params hash is
passed from the page rendered by the view in the *last* request /
response cycle, to the controller / method as the start of the *current*
request / response cycle.  Instance variables get passed from the
controller to the view templates in the current request / response cycle
to render the response page.  I apologize if my use of the word 'view'
confused.

> The action does its thing and renders the default update view which is
>  the view that I showed.  As far as I know, that's exactly what happens 
> when I have the @profile=profile line in my controller commented out.  

Yes.

> However, when I uncomment that line, for reasons unknown to me, I get a 
> totally different set of parameters available in my action even though 
> I used exactly the same URL in my browser.  It blows my mind! :)

Commenting or uncommenting that line has nothing at all to do with what
the controller is receiving in the params hash from a request initiated
via a page rendered in the last cycle.  It has only to do with what the
view template will render in the current cycle.  And if, in fact, the
view you showed is update.rhtml then that view will throw an error on
nil.each if you comment out line 13.  You haven't mentioned that.  Is it
happening or not?

This is too hard to follow in fits and spurts.  Zip your app up and send
it to me offline.  I'll take a look and get back to you with the
explanation.

Bill
bwalton dot im at gmail dot com


> 
> So, to answer your question:
> 
> > you've shown a controller method.  Is that method being
> > called from the view you showed?  Or generating the values passed to the
> > view template?
> 
> It is the later, i.e., the controller method generates the values
> passed to the view template.
> 
> > The request / response flow is what we need to
> >  understand to help you.
> 
> I hope that my response in this post has clarified the issue.  If not,
> please let me know.  Thanks.
> 
>            ... doug
> > 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to