diff --git a/app/controllers/layouts_controller.rb b/app/controllers/layouts_controller.rb index 45fc558..abb7b3e 100644 --- a/app/controllers/layouts_controller.rb +++ b/app/controllers/layouts_controller.rb @@ -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 diff --git a/app/models/layout.rb b/app/models/layout.rb index f66a572..c115fd7 100644 --- a/app/models/layout.rb +++ b/app/models/layout.rb @@ -1,2 +1,5 @@ class Layout < ActiveRecord::Base + def to_param + self.name + end end diff --git a/app/views/layouts/show.html.haml b/app/views/layouts/show.html.haml new file mode 100644 index 0000000..e7f176e --- /dev/null +++ b/app/views/layouts/show.html.haml @@ -0,0 +1,2 @@ +.notice + = flash[:notice] \ No newline at end of file