Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Rails Routes and Resources Routes to Create Actions Controller Action to Create Pages

Eric Lobatos
Eric Lobatos
2,112 Points

Controller Action to create pages: What does "render text:", do exactly? And what is "params"?

Is "params" a variable that was defined earlier in the coarse or its a built in method? And if so what does it do?

1 Answer

Jay McGavren
STAFF
Jay McGavren
Treehouse Teacher

render is a method defined on all controllers. It uses variables defined in your code to create a response to send back to the user's browser. Depending on its arguments, it can render plain text, an ERB template (which usually contains HTML), or other things. The text: argument specifies a plain string that it should render.

params is also a method defined on all controllers. It returns a hash-like object containing any URL parameters or form field contents submitted by the user's browser.