ActiveRecord - <%= and <% yielding different records

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.

Or from a direct call from a browser. My sentiments exactly. That’s
why I’m having so much difficulty explaining this behavior.

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?

Yes. That is exactly what is happening. I didn’t mention it because
that is expected behavior and it’s late enough in the game that I have
already ascertained everything I wanted to know so it really doesn’t
matter to me.

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

Do you want me to zip up the entire app directory and send it to you?
Is that what you’re saying? Please advise. Thanks.

      ... doug

On Mon, 2009-08-10 at 16:19 -0700, djolley wrote:

Do you want me to zip up the entire app directory and send it to you?
Is that what you’re saying? Please advise. Thanks.

I want to be able to run the app. The app directory is not sufficient.
Whatever your app is named it will live in a directory structure that
includes the app directory, the db directory, the config directory, the
lib directory… Zip that.

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. 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. 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. 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! :slight_smile:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs