diff --git a/app/controllers/macs_controller.rb b/app/controllers/macs_controller.rb index 14188e0..46d4aff 100644 --- a/app/controllers/macs_controller.rb +++ b/app/controllers/macs_controller.rb @@ -5,7 +5,10 @@ require "optparse" #require "rubygems" def index - @macs = Mac.all + @active_macs = Mac.where(:active => true, :hidden => false) + @active_macs += Mac.where(:active => true, :hidden => nil) + @hidden_macs = Mac.where(:active => true, :hidden => true) + @inactive_macs = Mac.where(:active => false) end # GET /macs/1 diff --git a/app/models/mac.rb b/app/models/mac.rb index 12f1a90..817c50a 100644 --- a/app/models/mac.rb +++ b/app/models/mac.rb @@ -1,4 +1,4 @@ class Mac < ActiveRecord::Base belongs_to :user - attr_accessible :active, :ip, :mac, :refreshed, :since, :user_id + attr_accessible :active, :ip, :mac, :refreshed, :since, :hidden, :note, :user_id end diff --git a/app/views/macs/_form.html.erb b/app/views/macs/_form.html.erb index 9759232..a45e6e4 100644 --- a/app/views/macs/_form.html.erb +++ b/app/views/macs/_form.html.erb @@ -13,12 +13,20 @@
+ Note: + <%= @mac.note %> +
+ ++ Hidden: + <%= @mac.hidden %> +
+ ++ IP: + <%= @mac.ip %> +
+ <%= link_to 'Edit', edit_mac_path(@mac) %> | <%= link_to 'Back', macs_path %> diff --git a/db/migrate/20130201042646_add_properties_to_macs.rb b/db/migrate/20130201042646_add_properties_to_macs.rb new file mode 100644 index 0000000..f75672a --- /dev/null +++ b/db/migrate/20130201042646_add_properties_to_macs.rb @@ -0,0 +1,6 @@ +class AddPropertiesToMacs < ActiveRecord::Migration + def change + add_column :macs, :hidden, :boolean + add_column :macs, :note, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 148d575..d957967 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130201022153) do +ActiveRecord::Schema.define(:version => 20130201042646) do create_table "cards", :force => true do |t| t.string "card_number" @@ -52,6 +52,8 @@ ActiveRecord::Schema.define(:version => 20130201022153) do t.boolean "active" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.boolean "hidden" + t.string "note" end add_index "macs", ["user_id"], :name => "index_macs_on_user_id"