[80568] branches/gsoc11-statistics/stats-server/app
derek at macports.org
derek at macports.org
Thu Jul 14 22:49:57 PDT 2011
Revision: 80568
http://trac.macports.org/changeset/80568
Author: derek at macports.org
Date: 2011-07-14 22:49:56 -0700 (Thu, 14 Jul 2011)
Log Message:
-----------
Add user model, update os_statistics model and views to reflect replacement of uuid column with user_id
- Added model/user.rb for Users table
- os_statistic.rb: changed uuid to user_id - added belong_to user relationship
- index.html.erb view updated to show user_id instead of uuid
- show.html.erb no longer displays uuid
Modified Paths:
--------------
branches/gsoc11-statistics/stats-server/app/models/os_statistic.rb
branches/gsoc11-statistics/stats-server/app/views/os_statistics/index.html.erb
branches/gsoc11-statistics/stats-server/app/views/os_statistics/show.html.erb
Added Paths:
-----------
branches/gsoc11-statistics/stats-server/app/models/user.rb
Modified: branches/gsoc11-statistics/stats-server/app/models/os_statistic.rb
===================================================================
--- branches/gsoc11-statistics/stats-server/app/models/os_statistic.rb 2011-07-15 05:34:28 UTC (rev 80567)
+++ branches/gsoc11-statistics/stats-server/app/models/os_statistic.rb 2011-07-15 05:49:56 UTC (rev 80568)
@@ -1,5 +1,7 @@
class OsStatistic < ActiveRecord::Base
- attr_accessible :uuid
+ belongs_to :user
+
+ attr_accessible :user_id
attr_accessible :macports_version
attr_accessible :osx_version
attr_accessible :os_arch
@@ -8,7 +10,7 @@
attr_accessible :gcc_version
attr_accessible :xcode_version
- validates :uuid, :presence => true
+ validates :user_id, :presence => true
validates :macports_version, :presence => true
validates :osx_version, :presence => true
validates :os_arch, :presence => true
Added: branches/gsoc11-statistics/stats-server/app/models/user.rb
===================================================================
--- branches/gsoc11-statistics/stats-server/app/models/user.rb (rev 0)
+++ branches/gsoc11-statistics/stats-server/app/models/user.rb 2011-07-15 05:49:56 UTC (rev 80568)
@@ -0,0 +1,4 @@
+class User < ActiveRecord::Base
+ has_one :os_statistics
+ has_many :installed_ports
+end
Modified: branches/gsoc11-statistics/stats-server/app/views/os_statistics/index.html.erb
===================================================================
--- branches/gsoc11-statistics/stats-server/app/views/os_statistics/index.html.erb 2011-07-15 05:34:28 UTC (rev 80567)
+++ branches/gsoc11-statistics/stats-server/app/views/os_statistics/index.html.erb 2011-07-15 05:49:56 UTC (rev 80568)
@@ -120,7 +120,7 @@
<table border=1>
<tr>
<th> ID </th>
- <th> UUID </th>
+ <th> user_id </th>
<th> MacPorts Version</th>
<th> OSX Version</th>
<th> OS Arch </th>
@@ -134,7 +134,7 @@
<% @stats.each do |row| %>
<tr>
<td> <%= row.id %> </td>
- <td> <%= row.uuid %> </td>
+ <td> <%= row.user_id %> </td>
<td> <%= row.macports_version %> </td>
<td> <%= row.osx_version %></td>
<td> <%= row.os_arch %> </td>
Modified: branches/gsoc11-statistics/stats-server/app/views/os_statistics/show.html.erb
===================================================================
--- branches/gsoc11-statistics/stats-server/app/views/os_statistics/show.html.erb 2011-07-15 05:34:28 UTC (rev 80567)
+++ branches/gsoc11-statistics/stats-server/app/views/os_statistics/show.html.erb 2011-07-15 05:49:56 UTC (rev 80568)
@@ -1,5 +1,3 @@
-<p>UUID: <%= @os_stats.uuid %></p>
-
<p> macports_version: <%= @os_stats.macports_version %> </p>
<p> osx_version: <%= @os_stats.osx_version %></p>
<p> os_arch: <%= @os_stats.os_arch %> </p>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110714/705987c3/attachment.html>
More information about the macports-changes
mailing list