Adding weight & tag

This commit is contained in:
Tyler Renelle 2012-02-01 11:16:12 -05:00
parent be779df79b
commit 571325d61d
3 changed files with 12 additions and 1 deletions

View file

@ -18,7 +18,8 @@ class HabitsController < ApplicationController
# GET /habits/new
# GET /habits/new.json
def new
@habit = Habit.new(:user_id => current_user.id)
@habit = Habit.new
@habit.weight = Habit.maximum('weight') + 1
respond_to do |format|
format.html # new.html.erb

View file

@ -23,6 +23,14 @@
<%= f.label :notes %><br />
<%= f.text_area :notes %>
</div>
<div class="field">
<%= f.label :weight %><br />
<%= f.text_field :weight %>
</div>
<div class="field">
<%= f.label :tag %><br />
<%= f.text_field :tag %>
</div>
<div class="actions">
<%= f.submit %>
</div>

View file

@ -9,6 +9,8 @@ class CreateHabits < ActiveRecord::Migration
t.boolean :down, :default => true
t.boolean :done, :default => false
t.text :notes
t.integer :weight, :default => 1
t.string :tag
t.timestamps
end