Newbie Qs - Authentication Plugin that supports Instances? Also, Rails 2.3 or 3 for Beginners?

Hello, this is my first week with Rails.

I'm working to create an app that has Users associated to instances by
their email address. For example, like Yammer, those with the email
domain "yahoo.com" only see what others with the same domain see...
Also like Basecamp where you only see your stuff but it all lives in
the DB.

Is there an authentication plug-in that supports that? ie
1. Registration that is email based (no usernames)
2. Users are assigned to an instance based on their email domain, and
only see data that is associated to their instance.

Lastly, as I'm new should I start with Rails 3 or stick with Rails
2.3? From what I can tell
Pro of Rails 3: I can learn fresh from the start
Con of Rails 3: Plugins are all for Rails 2+

Thanks for any thoughts or pointers on the above.

B

Is there an authentication plug-in that supports that? ie

  1. Registration that is email based (no usernames)

If it isn’t the default, it’s certainly an option in the most popular authentication plugins out there: AuthLogic and Devise. Which one to choose depends on how you feel sessions should be managed and what API you prefer.

Personally, I think the Rack environment is a good place to maintain sessions, especially if you might use other Rack-based apps that need to tie into an authenticated session. That’s why I use Devise.

Authlogic feels that a session is in fact a model, much similar to other models in Rails. It’s certainly a very nice gem, with lots of features and very reliable.

  1. Users are assigned to an instance based on their email domain, and
    only see data that is associated to their instance.

That’s your job, you just make the necessary model relationships to handle it.

Lastly, as I’m new should I start with Rails 3 or stick with Rails
2.3? From what I can tell
Pro of Rails 3: I can learn fresh from the start
Con of Rails 3: Plugins are all for Rails 2+

Don’t let plugins hold you back, most of the ones you’ll need either have a rails 3 compatible version available or at least a branch on github that supports Rails 3. That includes the two authentication gems I talked about a bit earlier.

Quite a lot of syntax and features in Rails 3 are quite different from Rails 2 though, so you’ll be limited to some specific blog posts and the RoR docs themselves.

Best regards

Peter De Berdt

@Peter, thanks for the reply, very helpful.

#1 - I'm going to go with Devise, I found a railscasts video that
should make installing it easy
#2 - I'll go with Rails 3, might as well learn the new stuff
#3 - Regarding "That's your job, you just make the necessary model
relationships to
handle it." That makes sense, thanks for pointing that out. If you can
give any tips to point me in the right direction. Example, where would
a Rails developer add the logic to extract the email domain, create a
table to store all the domains along with IDs, and then check against
that whenever a new registration takes place.

Also, in terms of making sure users of Domain A only see Domain A
content, I'm guessing all my models will need to have the instanceID
added? thxs

B

nobosh wrote:

@Peter, thanks for the reply, very helpful.

#1 - I'm going to go with Devise, I found a railscasts video that
should make installing it easy

Devise is great. Clearance works well also, though it has fewer options.
Clearance is email based by default, you would have to add user name
support on your own if you wanted.

Also, in terms of making sure users of Domain A only see Domain A
content, I'm guessing all my models will need to have the instanceID
added? thxs

B

You're making it more complicated than it really is.

class Domain
  has_many :users
end

class User
  belongs_to :domain
end

Then just check against the current user's domain.