Skip to content

Commit

Permalink
Migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon committed Jan 21, 2011
1 parent 22e1a89 commit 5ebc084
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/models/department.rb
@@ -1,5 +1,6 @@
class Department < ActiveRecord::Base

has_many :users
has_friendly_id :name, :use_slug => true

end
2 changes: 1 addition & 1 deletion app/views/users/show.html.erb
Expand Up @@ -9,7 +9,7 @@
</div>
<div class="bio right">
<h2><%= @user.name %></h2>
<h4><%= @user.department.name if @user.department %> - <%= @user.position %></h4>
<h4><%= link_to(@user.department.name, @user.department) if @user.department %> - <%= @user.position %></h4>

<% if @user.bio %>
<%= simple_format @user.bio %>
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20110121211424_adding_department_url.rb
@@ -0,0 +1,9 @@
class AddingDepartmentUrl < ActiveRecord::Migration
def self.up
add_column :departments, :cached_slug, :string
end

def self.down
remove_column :departments, :cached_slug
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Expand Up @@ -10,12 +10,13 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20110121171312) do
ActiveRecord::Schema.define(:version => 20110121211424) do

create_table "departments", :force => true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.string "cached_slug"
end

create_table "friendships", :force => true do |t|
Expand Down

0 comments on commit 5ebc084

Please sign in to comment.