Add semester field to alerts
This commit is contained in:
parent
851f370068
commit
c42a7fbfb5
6 changed files with 43 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
class Alert < ActiveRecord::Base
|
||||
attr_accessible :alerted, :course, :department, :user_id
|
||||
attr_accessible :alerted, :course, :department, :user_id, :semester
|
||||
|
||||
validates :department, :presence => true,
|
||||
:length => {
|
||||
|
@ -21,6 +21,7 @@ class Alert < ActiveRecord::Base
|
|||
:numericality => {
|
||||
only_integer: true
|
||||
}
|
||||
validates :semester, :presence => true
|
||||
|
||||
def alerted?
|
||||
@alerted
|
||||
|
|
|
@ -17,6 +17,12 @@
|
|||
<%= f.text_field :course, :class => 'text_field' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<%= f.label :semester, :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field :semester, :class => 'text_field' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<%= f.label :alerted, :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<th><%= model_class.human_attribute_name(:user_id) %></th>
|
||||
<th><%= model_class.human_attribute_name(:department) %></th>
|
||||
<th><%= model_class.human_attribute_name(:course) %></th>
|
||||
<th><%= model_class.human_attribute_name(:semester) %></th>
|
||||
<th><%= model_class.human_attribute_name(:alerted) %></th>
|
||||
<th><%= model_class.human_attribute_name(:created_at) %></th>
|
||||
<th><%=t '.actions', :default => t("helpers.actions") %></th>
|
||||
|
@ -21,6 +22,7 @@
|
|||
<td><%= alert.user_id %></td>
|
||||
<td><%= alert.department %></td>
|
||||
<td><%= alert.course %></td>
|
||||
<td><%= alert.semester %></td>
|
||||
<td><%= alert.alerted %></td>
|
||||
<td><%=l alert.created_at %></td>
|
||||
<td>
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
<dd><%= @alert.department %></dd>
|
||||
<dt><strong><%= model_class.human_attribute_name(:course) %>:</strong></dt>
|
||||
<dd><%= @alert.course %></dd>
|
||||
<dt><strong><%= model_class.human_attribute_name(:semester) %>:</strong></dt>
|
||||
<dd><%= @alert.semester %></dd>
|
||||
<dt><strong><%= model_class.human_attribute_name(:alerted) %>:</strong></dt>
|
||||
<dd><%= @alert.alerted %></dd>
|
||||
</dl>
|
||||
|
|
5
db/migrate/20130403233851_add_semester_to_alerts.rb
Normal file
5
db/migrate/20130403233851_add_semester_to_alerts.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddSemesterToAlerts < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :alerts, :semester, :string
|
||||
end
|
||||
end
|
26
db/schema.rb
Normal file
26
db/schema.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
# encoding: UTF-8
|
||||
# This file is auto-generated from the current state of the database. Instead
|
||||
# of editing this file, please use the migrations feature of Active Record to
|
||||
# incrementally modify your database, and then regenerate this schema definition.
|
||||
#
|
||||
# Note that this schema.rb definition is the authoritative source for your
|
||||
# database schema. If you need to create the application database on another
|
||||
# system, you should be using db:schema:load, not running all the migrations
|
||||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
||||
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130403233851) do
|
||||
|
||||
create_table "alerts", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.string "department"
|
||||
t.string "course"
|
||||
t.boolean "alerted"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "semester"
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue