Skip to content

Commit

Permalink
Fixed migration and view
Browse files Browse the repository at this point in the history
  • Loading branch information
Luiz Fernando committed Mar 4, 2009
1 parent 1678810 commit 05ab043
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/dojo.rb
Expand Up @@ -3,6 +3,7 @@ class Dojo < ActiveRecord::Base
has_one :retrospective

validates_presence_of :date
validates_presence_of :block_list_date

def self.next
Dojo.find :first, :conditions => ["date > ?", Time.now], :order => "date ASC"
Expand Down
2 changes: 1 addition & 1 deletion app/views/dojos/index.html.erb
Expand Up @@ -55,7 +55,7 @@
<% if (@dojo) %>
<div class="confirmation">
<% if @dojo.block_list? %>
<h2>The participant list for the next Dojo is blocked</h2>
<form><h2 class="info">The participant list for the next Dojo is blocked</h2></form>
<% else %>
<% form_for @participant, :url => dojo_participants_path(@dojo) do |f| %>
<h2>Confirme sua presen&ccedil;a</h2>
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20090303202721_add_block_list_date_to_dojo.rb
@@ -1,6 +1,11 @@
class AddBlockListDateToDojo < ActiveRecord::Migration
def self.up
add_column :dojos, :block_list_date, :datetime
Dojo.transaction do
Dojo.find(:all).each do |d|
d.update_attributes :block_list_date => d.date
end
end
end

def self.down
Expand Down
6 changes: 6 additions & 0 deletions public/stylesheets/dojo.css
Expand Up @@ -114,6 +114,12 @@ body {
margin: 0 0 0 8px;
}

.confirmation h2.info {
text-indent: 0px;
padding: 70px 15px 0;
font-size: 1.3em;
}

.confirmation form {
padding: 13px 30px 20px 30px;
background: transparent url("../images/box-amarelo_esquerdo.png") no-repeat top left;
Expand Down
8 changes: 8 additions & 0 deletions spec/models/dojo_spec.rb
Expand Up @@ -72,6 +72,14 @@ def valid_dojo_attributes
@dojo.date = Time.now + 1.days
@dojo.should be_valid
end

it "should require a block list date" do
@dojo.attributes = valid_dojo_attributes.except :block_list_date
@dojo.should_not be_valid
@dojo.errors.on(:block_list_date).should include("can't be blank")
@dojo.block_list_date = Time.now + 1.days
@dojo.should be_valid
end

it "should relate to participants" do
Dojo.reflect_on_association(:participants).should_not be_nil
Expand Down

0 comments on commit 05ab043

Please sign in to comment.