Skip to content

Commit

Permalink
Organizations can now pitch
Browse files Browse the repository at this point in the history
  • Loading branch information
spherop committed Sep 18, 2009
1 parent 7a25334 commit ceae8e0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/homes_controller.rb
Expand Up @@ -9,7 +9,7 @@ def start_story
if !logged_in?
session[:return_to] = start_story_path
redirect_to new_session_path
elsif logged_in? && current_user.is_a?(Reporter)
elsif logged_in? && current_user.is_a?(Reporter) || current_user.is_a?(Organization)
redirect_to new_pitch_path
else
redirect_to new_tip_path
Expand Down
2 changes: 1 addition & 1 deletion app/models/pitch.rb
Expand Up @@ -170,7 +170,7 @@ def self.with_sort(sort='desc')
end

def self.createable_by?(user)
user && user.reporter?
user && user.reporter? || user.organization?
end

def featured?
Expand Down
1 change: 1 addition & 0 deletions config/environment.rb
Expand Up @@ -22,6 +22,7 @@
config.gem "rubyist-aasm", :lib => "aasm", :version => '>=2.0.5', :source => 'http://gems.github.com'
config.gem 'mislav-will_paginate', :lib => 'will_paginate', :version => '>=2.3.7', :source => 'http://gems.github.com/'
config.gem "rspec-rails", :lib => false, :version => "= 1.2.2"
config.gem "rspec", :lib => false, :version => "= 1.2.2"
config.gem "cucumber", :lib => false, :version => "= 0.1.16"
config.gem "webrat", :lib => false, :version => ">= 0.4.4"
config.gem "money", :version => ">=2.1.3"
Expand Down
@@ -1,5 +1,6 @@
class LoadDisplayNameForDefaultNetwork < ActiveRecord::Migration
def self.up
#Network.reset_column_information
Network.create!(:name => 'sfbay', :display_name => 'Bay Area')
end

Expand Down
4 changes: 4 additions & 0 deletions spec/models/pitch_spec.rb
Expand Up @@ -508,6 +508,10 @@
it "is creatable by reporter" do
Pitch.createable_by?(Factory(:reporter)).should be
end

it "is creatable by organization" do
Pitch.createable_by?(Factory(:organization)).should be
end

it "is not creatable by user" do
Pitch.createable_by?(Factory(:user)).should_not be_true
Expand Down

0 comments on commit ceae8e0

Please sign in to comment.