Skip to content

Commit

Permalink
finished create layout successful submission scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
tooky committed Mar 20, 2009
1 parent d461a08 commit c2a71fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/controllers/layouts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ def new

def create
@layout = Layout.new(params[:layout])
if @layout.save
redirect_to layout_path(@layout)
respond_to do |format|
format.html do
if @layout.save
flash[:notice] = "Layout created successfully"
redirect_to layout_path(@layout)
end
end
end
end

def show
render :text => 'ok'

end
end
3 changes: 3 additions & 0 deletions app/models/layout.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
class Layout < ActiveRecord::Base
def to_param
self.name
end
end
2 changes: 2 additions & 0 deletions app/views/layouts/show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.notice
= flash[:notice]

0 comments on commit c2a71fb

Please sign in to comment.