Commit 1dca4928fdce5d612ea86d1e87885d3f8428c079
1 parent
92376e38
Exists in
master
and in
29 other branches
ActionItem0: removing user model
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@63 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
8 changed files
with
34 additions
and
57 deletions
Show diff stats
app/controllers/application.rb
| ... | ... | @@ -10,8 +10,8 @@ class ApplicationController < ActionController::Base |
| 10 | 10 | #We have to see a better way to do that |
| 11 | 11 | before_filter :load_boxes |
| 12 | 12 | def load_boxes |
| 13 | - if User.exists?(1) | |
| 14 | - owner = User.find(1) | |
| 13 | + if Profile.exists?(1) | |
| 14 | + owner = Profile.find(1) | |
| 15 | 15 | owner.nil? ? Array.new : @boxes = owner.boxes |
| 16 | 16 | end |
| 17 | 17 | end | ... | ... |
app/models/profile.rb
app/models/user.rb
| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | +class ActsAsTaggableMigration < ActiveRecord::Migration | |
| 2 | + def self.up | |
| 3 | + create_table :tags do |t| | |
| 4 | + t.column :name, :string | |
| 5 | + t.column :parent_id, :integer | |
| 6 | + t.column :pending, :bool | |
| 7 | + end | |
| 8 | + | |
| 9 | + create_table :taggings do |t| | |
| 10 | + t.column :tag_id, :integer | |
| 11 | + t.column :taggable_id, :integer | |
| 12 | + | |
| 13 | + # You should make sure that the column created is | |
| 14 | + # long enough to store the required class names. | |
| 15 | + t.column :taggable_type, :string | |
| 16 | + | |
| 17 | + t.column :created_at, :datetime | |
| 18 | + end | |
| 19 | + | |
| 20 | + add_index :taggings, :tag_id | |
| 21 | + add_index :taggings, [:taggable_id, :taggable_type] | |
| 22 | + end | |
| 23 | + | |
| 24 | + def self.down | |
| 25 | + drop_table :taggings | |
| 26 | + drop_table :tags | |
| 27 | + end | |
| 28 | +end | ... | ... |
db/migrate/006_create_users.rb
db/migrate/007_acts_as_taggable_migration.rb
| ... | ... | @@ -1,28 +0,0 @@ |
| 1 | -class ActsAsTaggableMigration < ActiveRecord::Migration | |
| 2 | - def self.up | |
| 3 | - create_table :tags do |t| | |
| 4 | - t.column :name, :string | |
| 5 | - t.column :parent_id, :integer | |
| 6 | - t.column :pending, :bool | |
| 7 | - end | |
| 8 | - | |
| 9 | - create_table :taggings do |t| | |
| 10 | - t.column :tag_id, :integer | |
| 11 | - t.column :taggable_id, :integer | |
| 12 | - | |
| 13 | - # You should make sure that the column created is | |
| 14 | - # long enough to store the required class names. | |
| 15 | - t.column :taggable_type, :string | |
| 16 | - | |
| 17 | - t.column :created_at, :datetime | |
| 18 | - end | |
| 19 | - | |
| 20 | - add_index :taggings, :tag_id | |
| 21 | - add_index :taggings, [:taggable_id, :taggable_type] | |
| 22 | - end | |
| 23 | - | |
| 24 | - def self.down | |
| 25 | - drop_table :taggings | |
| 26 | - drop_table :tags | |
| 27 | - end | |
| 28 | -end |
test/fixtures/boxes.yml
| ... | ... | @@ -2,15 +2,15 @@ |
| 2 | 2 | one: |
| 3 | 3 | id: 1 |
| 4 | 4 | number: 1 |
| 5 | - owner_type: 'User' | |
| 5 | + owner_type: 'Profile' | |
| 6 | 6 | owner_id: 1 |
| 7 | 7 | two: |
| 8 | 8 | id: 2 |
| 9 | 9 | number: 2 |
| 10 | - owner_type: 'User' | |
| 10 | + owner_type: 'Profile' | |
| 11 | 11 | owner_id: 1 |
| 12 | 12 | three: |
| 13 | 13 | id: 3 |
| 14 | 14 | number: 3 |
| 15 | - owner_type: 'User' | |
| 15 | + owner_type: 'Profile' | |
| 16 | 16 | owner_id: 1 | ... | ... |