Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
some installation instructions
  • Loading branch information
salex committed Aug 20, 2010
1 parent 4037011 commit c4820ec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
21 changes: 14 additions & 7 deletions README.textile
@@ -1,6 +1,6 @@
h1. Fork of Rails3-Subdomain-Devise modified for basecamp-like subdomaims

Use this project as a starting point for a Rails 3 application that uses subdomains and authentication. User management and authentication is implemented using "Devise":http://github.com/plataformatec/devise.
Use this project as a starting point for a Rails 3 application that uses basecamp-like subdomains and authentication. User management and authentication is implemented using "Devise":http://github.com/plataformatec/devise.

This is a stab of modifying "Rails3-Subdomain-Devise":http://github.com/fortuity/rails3-subdomain-devise/ to provide basecamp-like subdomains.

Expand All @@ -20,7 +20,7 @@ Routes and associations were modified:
root :to => "home#index"
</pre>

User and subdomains are no longer nested, but associated.
User and subdomains are no longer nested, but associated.

<pre><code>
class Subdomain < ActiveRecord::Base
Expand Down Expand Up @@ -55,23 +55,30 @@ User and subdomains are no longer nested, but associated.

The majority of the subdomains controller has been stubbed in that "sign_up" will create a subdomain if it does not exist. Code was not removed in that an Admin user might want to delete subdomains and associated users.

The model names were not changed, but take on different roles.
The model names were not changed, but take on different roles. List of other changes:

* Users#index probably should not be there, but it lists all users
* Site would be the home for the site and currently list users for the subdomain
* Subdomain still has user_id and indicates who created the subdomain (assume subdomain admin)
* A helper method "current_subdomain" was added to controllers/application.rb
* A helper method "current_subdomain" was added to controllers/application.rb to check if subdomain exists
* Another helper method "check_my_domain(subdomain)" will check a passed subdomain against the current domain. Subdomain is kind of the root table, all major tables should be belong to subdomain and this check is there to prevent url modification (edit member not belonging to your domain). It will redirect to an "opps" action in the site controller.
* Sign-in has been removed is no subdomain exists.
* Sign-in has been removed if no subdomain exists. If you modifiy the url and sign_in without a subdomain. It will log you in, but then immediately log you out and redirect to the subdomain sign_in form. I can't seem to get the flash notice to work in this area.
* If you register without a subdomain, it will be created if it does not exit. If it exists, you are added as a user of that subdomain (TODO this should be fixed to reject adding user from sign_up without subdomain if it exists)
* If you register in a subdomain, you are added to the users of that subdomain.
* If you register in a subdomain, you are added as a the users of that subdomain.

The rest of this readme is the original readme.
The rest of this readme is the original readme and of course does ot apply.

I will consider changing it if my stab got close!

P.S. I am not a novice at Rails, but don't consider myself experienced.

Installation (I think!)

* git clone
* bundle install
* rake db:create
* rake db:migrate
* rake db:seed


h1. Rails3-Subdomain-Devise
Expand Down
4 changes: 3 additions & 1 deletion db/seeds.rb
Expand Up @@ -6,7 +6,7 @@
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name => 'Daley', :city => cities.first)
puts 'SETTING UP EXAMPLE USERS'
user1 = User.create! :name => 'First User', :subdomain_name => "foo", :email => 'user@test.com', :password => 'please', :password_confirmation => 'please'
user1 = User.create! :name => 'Foo First User', :subdomain_name => "foo", :email => 'user@test.com', :password => 'please', :password_confirmation => 'please'
puts 'New user created: ' << user1.name
user2 = User.create! :name => 'Other User', :subdomain_name => "bar", :email => 'otheruser@test.com', :password => 'please', :password_confirmation => 'please'
puts 'New user created: ' << user2.name
Expand All @@ -15,3 +15,5 @@
puts 'Created subdomain: ' << subdomain1.name
subdomain2 = Subdomain.create! :name => 'bar', :user_id => user2.id
puts 'Created subdomain: ' << subdomain2.name
user3 = User.create! :name => 'Foo Second User', :subdomain_name => "foo", :email => 'user2@test.com', :password => 'please', :password_confirmation => 'please'
user3 = User.create! :name => 'Foo Third User', :subdomain_name => "foo", :email => 'user3@test.com', :password => 'please', :password_confirmation => 'please'

0 comments on commit c4820ec

Please sign in to comment.