Skip to content
Browse files

Merge branch 'master' of github.com:realleoman/Reservat

  • Loading branch information...
2 parents 2b6210d + e31fa1c commit b4084c60f46046e98fc7287fea2a5170ce365ac3 @fenixbrassi fenixbrassi committed Apr 3, 2011
Showing with 33 additions and 3 deletions.
  1. +12 −2 app/controllers/assets_controller.rb
  2. +12 −0 app/views/assets/new.html.haml
  3. +9 −1 app/views/assets/show.html.haml
View
14 app/controllers/assets_controller.rb
@@ -1,7 +1,5 @@
class AssetsController < ApplicationController
-
-
def index
@assets = Asset.all
end
@@ -10,5 +8,17 @@ def show
@asset = Asset.find params[:id]
end
+ def new
+ @asset = Asset.new
+ end
+
+ def create
+ @asset = Asset.new params[:asset]
+ if @asset.save
+ redirect_to assets_path
+ else
+ render 'new'
+ end
+ end
end
View
12 app/views/assets/new.html.haml
@@ -0,0 +1,12 @@
+%h3 New asset
+
+
+= form_for @asset, :url => assets_path(@asset) do |f|
+ %fieldset
+ %label Name
+ = f.text_field :name
+ %br
+ = f.collection_select :asset_type_id, AssetType.all, :id, :name
+ %br
+ = f.submit 'Crear'
+
View
10 app/views/assets/show.html.haml
@@ -1,6 +1,14 @@
%h2 Asset
-%p= @asset.name
+%table{:border => "1"}
+ %tbody
+ %tr
+ %td Name
+ %td= @asset.name
+ %tr
+ %td Type
+ %td= @asset.asset_type.name
+
%h3 Reservaciones

0 comments on commit b4084c6

Please sign in to comment.
Something went wrong with that request. Please try again.