Essentially the same should work.
<%= text_area 'comment', 'body', :onkeyup => "DjCheckMaxlength(this);", :maxlength => 30 %>
If you want to link externally:
<%= javascript_include_tag "my-functions" %>
Would get a JS file from public / javascripts / my-functions.js
source share