Params? #116

Closed
brainjuicer opened this Issue Apr 5, 2012 · 3 comments

Projects

None yet

2 participants

@brainjuicer

Hi @mde, it's nice to talk to you again. I have question about the params variable. What exactly is it's use? Is it the way to pass variables between the controllers and the views? Any reply is much appreciated.

Thanks,
Aero

@brainjuicer brainjuicer closed this Apr 5, 2012
@mde
Contributor
mde commented Apr 5, 2012

Did you get this figured out? The params property on the controller is a combination of things parsed out of the route (e.g., an ID for a resource-based route), the URL-params, and params from a form POST or PUT.

@brainjuicer brainjuicer reopened this Apr 5, 2012
@brainjuicer

Well, to be honest I don't think so. My real question is, how do variables get sent between the views and corresponding controllers? I would love to know because I have been banging my head against a wall about this. Thanks.

@mde
Contributor
mde commented Apr 6, 2012

Any variables you want in your views need to be explicitly passed when you render them from a controller-action.

Any key in the object-literal passed to the respond call is available as a local variable in your view. Passing 'params' is just an example of something you can pass in to use in the view. You can use one of the boilerplate views generated by geddy resource, and watch them spit out anything you add to the querystring, because they're just looping over the params passed into the view.

Hope that helps.

@mde mde closed this Apr 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment