Rails 4 Notes: Difference between revisions
Jump to navigation
Jump to search
Created page with "== Lessons that I've learned before == * <code><%= form_for ... %></code> instead of <code><% form_for ... %></code> * Chrome won't let you POST a form to local test instance..." |
No edit summary |
||
Line 5: | Line 5: | ||
== New lessons == | == New lessons == | ||
=== Routes === | |||
Routes need to be explicit (like a white list) to enhance security. | |||
<pre> | |||
get 'tasks' => 'task#index' | |||
get 'publications' => 'root#publications' | |||
get 'tasks/download_request' => 'task#download_request' | |||
post 'tasks/download_request' => 'task#download_request' | |||
</pre> | |||
=== Strong parameters === | === Strong parameters === |
Revision as of 22:33, 23 July 2014
Lessons that I've learned before
<%= form_for ... %>
instead of<% form_for ... %>
- Chrome won't let you POST a form to local test instance, only GET. Firefox is OK.
New lessons
Routes
Routes need to be explicit (like a white list) to enhance security.
get 'tasks' => 'task#index' get 'publications' => 'root#publications' get 'tasks/download_request' => 'task#download_request' post 'tasks/download_request' => 'task#download_request'
Strong parameters
http://edgeapi.rubyonrails.org/classes/ActionController/StrongParameters.html
jQuery
rails generate jquery:install
asset pipeline
add this to get javascript:
<%= javascript_include_tag "application" %>