Created
June 26, 2010 23:08
-
-
Save lastk/454430 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ArtistsController < ApplicationController | |
def index | |
redirect_to :action => "new" | |
end | |
def new | |
@artist = Artist.new(params[:artist]) | |
end | |
def create | |
@artist = Artist.new(params[:artist]) | |
if @artist.name == "rafael" | |
render :text => "ok" | |
else | |
redirect_to :action => "new", :artist => @artist | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% form_for @artist do |f| %> | |
<div> | |
<%= f.label :name %><br /> | |
<%= f.text_field :name %> | |
</div> | |
<%= f.submit :Save %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 17 should read:
render :action => 'new'