Commit 55fbbbb6b391abb9e9989cb9ca8e72e77f1a2e5f
1 parent
3b316fad
Exists in
master
and in
29 other branches
[template-welcome-page] Add welcome_page relation to profiles
(ActionItem3075)
Showing
3 changed files
with
15 additions
and
0 deletions
Show diff stats
app/models/profile.rb
... | ... | @@ -138,6 +138,11 @@ class Profile < ActiveRecord::Base |
138 | 138 | |
139 | 139 | has_many :comments_received, :class_name => 'Comment', :through => :articles, :source => :comments |
140 | 140 | |
141 | + # Although this should be a has_one relation, there are no non-silly names for | |
142 | + # a foreign key on article to reference the template to which it is | |
143 | + # welcome_page... =P | |
144 | + belongs_to :welcome_page, :class_name => 'Article', :dependent => :destroy | |
145 | + | |
141 | 146 | def scraps(scrap=nil) |
142 | 147 | scrap = scrap.is_a?(Scrap) ? scrap.id : scrap |
143 | 148 | scrap.nil? ? Scrap.all_scraps(self) : Scrap.all_scraps(self).find(scrap) | ... | ... |
db/migrate/20140409211533_add_welcome_page_id_to_profiles.rb
0 → 100644
db/schema.rb
... | ... | @@ -484,6 +484,7 @@ ActiveRecord::Schema.define(:version => 20140605222753) do |
484 | 484 | t.integer "activities_count", :default => 0, :null => false |
485 | 485 | t.string "personal_website" |
486 | 486 | t.string "jabber_id" |
487 | + t.integer "welcome_page_id" | |
487 | 488 | end |
488 | 489 | |
489 | 490 | add_index "profiles", ["activities_count"], :name => "index_profiles_on_activities_count" | ... | ... |