The params hash contains the following values:

<% params.each do |key, value| %>

<%= key %>: <%= value %>

<% end %> Rails Parameters

The params hash contains the following values:

<% params.each do |key, value| %>

<%= key %>: <%= value %>

<% end %>

Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 142 Lecture Notes: Rails Controllers and Views

Similar presentations


Presentation on theme: "CS 142 Lecture Notes: Rails Controllers and Views"— Presentation transcript:

1 CS 142 Lecture Notes: Rails Controllers and Views
Simple Rails Template <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " <html xmlns=" xml:lang="en" lang="en"> <head> <title>Hello, User</title> </head> <body> <p> This page was fetched at <%= Time.now() %> </p> </body> </html> CS 142 Lecture Notes: Rails Controllers and Views

2 Control Structures in Templates
?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " <html xmlns=" xml:lang="en" lang="en"> <head> <title>Rails Parameters</title> </head> <body> <p> The <code>params</code> hash contains the following values: </p> <% params.each do |key, value| %> <p><%= key %>: <%= value %></p> <% end %> </body> </ht CS 142 Lecture Notes: Rails Controllers and Views

3 CS 142 Lecture Notes: Rails Controllers and Views

4 CS 142 Lecture Notes: Rails Controllers and Views
Templates printf("The capital of %s is %s\n", state, capital); vs. print("The capital of); print(state); print(" is "); print(capital); print("\n"); CS 142 Lecture Notes: Rails Controllers and Views


Download ppt "CS 142 Lecture Notes: Rails Controllers and Views"

Similar presentations


Ads by Google