<form name="f" action="/account/login" method="post" onsubmit="wait();">
...
</form>
Now what you want is more like this:
<% form_tag("/account/login", :name=>'f', :onsubmit=>"wait();") { %>
...
<% } %>
The above code takes care of the new CSRF-proof keys and all that. As you can see, my example is a bit more complex than usual, with a form name and an onsubmit javascript callback, but hey, its real code!
For a simpler, bare-bones form, Rails 2 style, here you go:
<% form_tag :action=> "new" do %>
...
<% end %>
u = find_first(["login = ? AND password = ?", login, sha1(pass)])
You need something more like this nowadays:
u = find :first, :conditions=>["login = ? AND password = ?", login, sha1(pass)]
It appears that all the find_* functions (find_first,find_all,etc) have all been rolled into the one-function-to-rule-them-all 'find' function. I guess it is neater.
@session
@request
With this:
session
request
One big 'find-in-files' (Ctrl-Shift-F in Notepad++) will sort you out with this one.
redirect_to_url '/blah/foo'
...becomes...
redirect_to '/yada/yada'
@user_pages, @users = paginate :users, :per_page => 30, :order=>'login'
Became:
@users = User.find :all, :order=>'login'
Its pretty simple, and you'll need to remove all references to pagination in your views. If you really *really* need pagination, you'll need something more complex, but there isn't anything out-of-the-box for you.
For more details: http://wiki.rubyonrails.org/rails/pages/HowtoPagination
Thanks for reading! And if you want to get in touch, I'd love to hear from you: chris.hulbert at gmail.
(Comp Sci, Hons - UTS)
Software Developer (Freelancer / Contractor) in Australia.
I have worked at places such as Google, Cochlear, Assembly Payments, News Corp, Fox Sports, NineMSN, FetchTV, Coles, Woolworths, Trust Bank, and Westpac, among others. If you're looking for help developing an iOS app, drop me a line!
Get in touch:
[email protected]
github.com/chrishulbert
linkedin