RubyFlow The Ruby and Rails community linklog

Example App for Rails 3 + Mongoid + Devise

On GitHub: rails3 mongoid devise example app and tutorial. With an application template generator so anyone can use the example as a beginning point for a new Rails app. Options for Haml and Heroku.

Comments

this is a great tutorial - thnks a lot - i’m just moving an app over to rails3 right now and using your tut as a guide

PS - I have found a couple of really small bugs… thought you might like to know

1 - search for the following line in your tutorial, http://admin.localhost:3000 - it appears three times and should obviously read http://localhost:3000 - it’s a small error but noob’s might be thrown by it

2 - You will need the following in your Gemfile if you want to use haml off the bat:

gem ‘haml’ gem ‘rails3-generators’, :group => :development

3 - The following deprecation error is thrown:

ActionMailer::Base.default_charset=value is deprecated, use default :charset => value instead.

The fix for this seems to be to remove the following line from the development and production environments:

config.action_mailer.default_charset = “utf-8”

and replace it with this one:

config.action_mailer.default :charset => “utf-8”

A subtle difference, but it stops the Deprecation warnings

4 - just finally, right at the end, after running “heroku rake db:seeds” I got the “failed to connect to any given host:port” error message. You wrote the following warning about that error:

If you get the error message “failed to connect to any given host:port”, you likely failed to set up your config/application.rb file to include the MongoHQ connection parameters.

Well, you didn’t actually mention that step in the tutorial. I found out how to do it by copying the code from the application.rb file in your github repo. Most smart people will realise that they need to do that, but some noob’s might stumble here… I’d suggest adding the step to the tutorial for the sake of helping them out.

Anyway, it’s a seriously great tutorial - I’m so much happier using devise than authlogic and mongodb/hq is something I’ve been meaning to get my head around for a while now - thanks again :)

PPS - hope you don’t think I’m being cheeky pointing out the bugs there - I used to work in games testing, which explains a lot - and I appreciate the time you’ve obviously taken writing that tutorial up

@stephenmurdoch, thanks for identifying and fixing the errors! Not cheeky at all. I put the example out here for improvements and I appreciate your time and effort to offer the detailed corrections.

stephenmurdoch’s corrections are now incorporated in the GitHub repo and wiki.

Daniel - This is great. And I’ve also learned alot from playing around with the template file. I wasn’t aware you could string so many actions together like that and basically set up an app in seconds.

I am having an issue with logging in to your example app. I can sign up as a new user (which logs me in) but when I try to sign in, I’m told Im using an invalid password. This happens even with the user name and password that I seeded. Also, the field for ‘name’ is not shown when signing up as a new user. So if I enter an email and password, I’m told, because of the validations, that I must enter a name. I was able to fix this by running the ‘rails generate devise:views’ and then adding the name field manually. This let me sign up, but I still can’t figure out how to signin.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in