Skip to content

Commit

Permalink
Finishing up the implementation of Organization subdomains.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Bommarito committed Jul 3, 2012
1 parent 474b29f commit 17bf3d0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/controllers/organization_base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def load_organization

def store_subdomain_and_redirect_to_new_organization
session[:available_subdomain] = request.subdomain
flash[:notice] = 'You visited a non-existent subdomain. It is available for your use if you wish to signup'
redirect_to new_organization_url(subdomain: 'www') and return
end
end
1 change: 1 addition & 0 deletions app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class OrganizationsController < OrganizationBaseController

def new
@organization = Organization.new
@organization.subdomain = session[:available_subdomain] if session[:available_subdomain].present?
end

def create
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/session_store.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Be sure to restart your server when you modify this file.

Redtix::Application.config.session_store :cookie_store, key: '_redtix_session'
Redtix::Application.config.session_store :cookie_store, key: '_redtix_session', :domain => :all

# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
Expand Down
6 changes: 4 additions & 2 deletions features/step_definitions/organization_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@
end

Then /^I should see the subdomain already filled in for me$/ do
pending # express the regexp above with the code you wish you had
find('#organization_subdomain').value.should == 'non-existent'
end

Then /^I should see a message that says that subdomain is available$/ do
pending # express the regexp above with the code you wish you had
within('#flash .notice') do
page.should have_content('You visited a non-existent subdomain. It is available for your use if you wish to signup')
end
end

Then /^I should see the Organization's information$/ do
Expand Down

0 comments on commit 17bf3d0

Please sign in to comment.