Giter Site home page Giter Site logo

railsapps / rails-prelaunch-signup Goto Github PK

View Code? Open in Web Editor NEW
446.0 34.0 192.0 354 KB

An example Rails 3.2 app for a web startup prelaunch site.

Home Page: http://railsapps.github.io/rails-prelaunch-signup

Ruby 95.60% JavaScript 2.60% CoffeeScript 0.29% CSS 1.51%

rails-prelaunch-signup's Introduction

Rails App for a Startup Prelaunch Signup Site Rails App for a Startup Prelaunch Signup Site

Rails 3.2 example application for a “beta launching soon” startup prelaunch signup site.

Best of all, there’s a detailed tutorial to show how it is built.

You can build this application in only a few minutes using the Rails Composer tool.

Rails Application for a Startup Prelaunch Signup Site

Read an interview with Michael Gajda about how he used the project to launch his startup site.

Notable Forks

Alternative version Author
rails-prelaunch-signup-1click single-click email submit (no modal) Chad Kruse

Follow on Twitter Follow on Twitter

Follow the project on Twitter: @rails_apps. Please tweet some praise if you like what you’ve found.

Introduction

The initial app for a typical web startup announces the founders’ plans and encourages visitors to enter an email address for future notification of the site launch. It’s not difficult to build such an app in Rails.

But why build it yourself if others have already done so? This project aims to:

  • eliminate effort spent building an application that meets a common need;
  • offer code that is already implemented and tested by a large community;
  • provide a well-thought-out app containing most of the features you’ll need.

By using code from this project, you’ll be able to:

  • direct your attention to the design and product offer for your prelaunch site;
  • get started faster building the ultimate application for your business.

What Is Implemented — and What Is Not

This is a complete and fully functional application.

For the user:

  • an offer with a “request invite” button
  • a “request invitation” form in a modal window
  • “Thank you” acknowledgement includes social sharing buttons (Twitter, Facebook, Google+)
  • visitor receives an email acknowledging their request
  • visitor’s request for an invitation creates an “unconfirmed” account
  • a welcome email when a user is invited by a site administrator
  • a link in the welcome email confirms the user’s account and sets a password

For the site owner:

  • administrative dashboard page
  • list of all visitors who have requested invitations
  • site owner can send individual invitations
  • “bulk invitation” feature to send 50, 100, or more invitations
  • see status for any user: “uninvited”, “confirmed”, “last visit”

Implementation details:

  • Twitter Bootstrap
  • modal window for invitation requests updated by AJAX
  • Javascript updates the modal window for any form submission errors
  • uses an email service provider for transactional email
  • captures visitor email addresses for a MailChimp mailing list

Tutorial shows how to:

  • write user stories
  • use Devise for user management and authentication
  • use CanCan for role-based authorization
  • keep account passwords secret using environment variables
  • use git and GitHub for source control
  • deploy using Heroku

Unimplemented

  • queuing (asynchronous processing) for transactional email and MailChimp list capture
  • caching
  • A/B testing of offers
  • Google analytics
  • “about” and “contact” pages

If you add features or improve the implementation, please consider contributing by submitting an issue or pull request from your fork.

Alternatives

This is an application for Rails developers who wish to deploy their own application. It is a good stepping stone to building a more complex application for your startup. You’ll own your own code and can customize to your needs.

Unlike a service such as LaunchRock, KickoffLabs and Unbounce, you’ll have your own application you can customize as you wish. Just as important, when your visitors sign up, they are creating real user accounts in a user management system you can use after you launch.

If you do not want to build an application, or you are not a Rails developer, you may wish to consider alternatives.

Hosted Services

  • LaunchRock – “set up a social launching-soon page in minutes”
  • KickoffLabs – “viral landing pages you’ll love in 60 seconds”
  • Prefinery – “complete beta management platform that encourages social sharing”
  • Unbounce – “create, publish & A/B test landing pages”

WordPress Themes

WordPress themes are a popular way to stage a startup prelaunch page.

Similar Projects

You can find other projects on GitHub that offer similar functionality.

Author Project Description
codelitt launchpage-rails Signup for two different types of users
johngrimes t-minus Instant prelaunch page for your Rails 3 app
renderedtext coming-soon Sinatra app to show a pre-launch page and collect emails
hashrocket coming-soon Sinatra app to register email addresses
jbeyers django-prelaunch Django app to gather email addresses with a referral mechanism

Found others? Please create an issue with your suggestion or email the author.

Articles and Discussion

Here are some articles that describe the purpose and options for a startup prelaunch page:

Have other suggestions? Please create an issue with your suggestion or email the author.

RailsApps Examples and Tutorials

This is one in a series of Rails example apps and tutorials from the RailsApps Project.

This application is based on two of the RailsApps example apps:

The first example shows how to set up Devise for user authentication. It also shows how to set up the app to use RSpec and Cucumber for testing.

The second example shows how to set up Devise and add CanCan to manage access to administrative pages. It also shows how to set up Twitter Bootstrap as a front-end framework for CSS styling.

You can use this example without studying these example applications; if you find you are lost, it may be helpful to look at the two simpler examples.

If you want to use the MongoDB datastore instead of ActiveRecord and a SQL database, look at rails3-mongoid-devise example.

Tutorial

An in-depth tutorial is available (subscription required). Subscriptions provide financial support for the RailsApps project.

You can use the starter app without getting the tutorial. The tutorial provides a detailed explanation of the code:

The tutorial documents each step to follow to create the application. Every step is documented concisely, so a complete beginner can create this application without any additional knowledge. However, no explanation is offered for any of the steps, so if you are a beginner, you’re advised to look for an introduction to Rails elsewhere. If you’re new to Rails, see recommendations for a Rails tutorial and a list of top resources for Ruby and Rails. The article What is Ruby? And Rails? is a good place to get a basic introduction to Rails.

If you simply wish to modify the application for your own project, you can generate the application and set it up as described below, without following the tutorial.

Dependencies

Before generating your application, you will need:

  • The Ruby language (version 1.9.3 or 2.0.0)
  • The Rails gem (version 3.2.13)

See Installing Rails for detailed instructions and advice.

Accounts You May Need

Before you start, you may need to set up accounts for hosting and email.

Hosting

For easy deployment, use a “platform as a service” provider such as:

Instructions are provided for deployment to Heroku.

Transactional Email

For simple testing of email, it’s easy to use Gmail to send email messages from the application. For deployment, when the application must send dozens or thousands of acknowledgments or invitations, you will need a hosted SMTP relay service (also known as an ESP or “email service provider”). We provide instructions for Mandrill by MailChimp. The Mandrill transactional email service integrates well with the MailChimp email list manager service. Plus, you can send up to 12,000 emails/month from the service for free.

Sign up for a MailChimp account to get started. After you’ve created your MailChimp account, see the instructions to Use Mandrill with MailChimp. Then get the Access Information (your SMTP username and password, which is an API key).

Mailing List

In addition to sending transactional email messages, you likely will want to send newsletters or announcements to your entire mailing list. The tutorial shows how to add visitors who request an invitation to a MailChimp list. MailChimp allows you to send up to 12,000 emails/month to list of 2000 or fewer subscribers for free. After you sign up for a MailChimp account, get your API key. Look under “Account” for “API Keys and Authorized Apps.” Note that the Mandrill API key (which you get on the mandrill.com site) is different from the MailChimp API key (which you get on the mailchimp.com site).

Getting the Application

You have several options for getting the code. You can fork, clone, or generate.

Fork

If you’d like to add features (or bug fixes) to improve the example application, you can fork the GitHub repo and make pull requests. Your code contributions are welcome!

Clone

If you want to copy and customize the app with changes that are only useful for your own project, you can clone the GitHub repo. You’ll need to search-and-replace the project name throughout the application. You probably should generate the app instead (see below). To clone:

$ git clone git://github.com/RailsApps/rails-prelaunch-signup.git

You’ll need git on your machine. See Rails and Git.

Generate

If you want to use the project as a starter app, use the Rails Composer tool to generate a new version of the example app. You’ll be able to give it your own project name when you generate the app. Generating the application gives you many additional options.

To build the example application, run the command:

$ rails new rails-prelaunch-signup -m https://raw.github.com/RailsApps/rails-composer/master/composer-Rails3_2.rb -T

Use the -T flag to skip Test::Unit files.

The $ character indicates a shell prompt; don’t include it when you run the command.

This creates a new Rails app named rails-prelaunch-signup on your computer. You can use a different name if you wish.

You’ll see a prompt:

question  Install an example application?
      1)  I want to build my own application
      2)  membership/subscription/saas
      3)  rails-prelaunch-signup
      4)  rails3-bootstrap-devise-cancan
      5)  rails3-devise-rspec-cucumber
      6)  rails3-mongoid-devise
      7)  rails3-mongoid-omniauth
      8)  rails3-subdomains

Choose rails-prelaunch-signup. The Rails Composer tool may give you other options (other choices may have been added since these notes were written).

The application generator template will ask you for additional preferences:

 question  Git branch for the prelaunch app?
       1)  wip (work-in-progress)
       2)  master
       3)  prelaunch
       4)  staging
 question  Git branch for the main app?
       1)  None
       2)  wip (work-in-progress)
       3)  edge
 question  Web server for development?
       1)  WEBrick (default)
       2)  Thin
       3)  Unicorn
       4)  Puma
 question  Web server for production?
       1)  Same as development
       2)  Thin
       3)  Unicorn
       4)  Puma
 question  Template engine?
       1)  ERB
       2)  Haml
       3)  Slim
   extras  Set a robots.txt file to ban spiders? (y/n)
   extras  Use or create a project-specific rvm gemset? (y/n)
   extras  Create a GitHub repository? (y/n)

Git Branches

The application template will create Git branches for you. This allows you to maintain two versions of the application: one for immdediate deployment as a prelaunch app; and another version that you can use for ongoing development. I recommend deploying the prelaunch app in the “master” branch. Work on your ultimate application in a “wip” branch.

Web Servers

We recommend Thin in development for speed and less noise in the log files.

If you plan to deploy to Heroku, select Thin as your production webserver.

Template Engine

The example application uses the default “ERB” Rails template engine. Optionally, you can use another template engine, such as Haml or Slim. See instructions for Haml and Rails.

Other Choices

Set a robots.txt file to ban spiders if you want to keep your new site out of Google search results.

It is a good idea to use rvm, the Ruby Version Manager, and create a project-specific rvm gemset (not available on Windows). See Installing Rails.

If you choose to create a GitHub repository, the generator will prompt you for a GitHub username and password.

Troubleshooting

If you get an error “OpenSSL certificate verify failed” or “Gem::RemoteFetcher::FetchError: SSL_connect” see the article OpenSSL errors and Rails.

If you get an error like this:

Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
    composer  Running 'after bundler' callbacks.
The template [...] could not be loaded.
Error: You have already activated ..., but your Gemfile requires ....
Using bundle exec may solve this.

It’s due to conflicting gem versions. See the article Rails Error: “You have already activated (…)”.

Edit the README

If you’re storing the app in a GitHub repository, please edit the README files to add a description of the app and your contact info. If you don’t change the README, people will think I am the author of your version of the application.

Getting Started

See the article Installing Rails to make sure your development environment is prepared properly.

Use RVM

I recommend using rvm, the Ruby Version Manager, to create a project-specific gemset for the application. If you generate the application with the Rails Composer tool, you can create a project-specific gemset.

Install the Required Gems

Check the Gemfile to see which gems are used by this application.

If you used the Rails Composer tool to generate the example app, the application template script has already run the bundle install command.

If not, you should run the bundle install command to install the required gems on your computer:

$ bundle install

You can check which gems are installed on your computer with:

$ gem list

Keep in mind that you have installed these gems locally. When you deploy the app to another server, the same gems (and versions) must be available.

I recommend using rvm, the Ruby Version Manager, to create a project-specific gemset for the application. See the article Installing Rails.

Configure Email

You must configure the application for your email account. See the article Send Email with Rails.

Configure Devise

You can modify the configuration file for Devise if you want to use something other than the defaults:

  • config/initializers/devise.rb

Configuration File

The application uses the figaro gem to set environment variables. Credentials for your administrator account and email account are set in the config/application.yml file. The .gitignore file prevents the config/application.yml file from being saved in the git repository so your credentials are kept private. See the article Rails Environment Variables for more information.

Modify the file config/application.yml:

# Add account credentials and API keys here.
# See http://railsapps.github.io/rails-environment-variables.html
# This file should be listed in .gitignore to keep your settings secret!
# Each entry sets a local environment variable and overrides ENV variables in the Unix shell.
# For example, setting:
# GMAIL_USERNAME: Your_Gmail_Username
# makes 'Your_Gmail_Username' available as ENV["GMAIL_USERNAME"]
# Add application configuration variables here, as shown below.
#
MANDRILL_USERNAME: Your_Username
MANDRILL_API_KEY: Your_Mandrill_API_Key
MAILCHIMP_API_KEY: Your_MailChimp_API_Key
MAILCHIMP_LIST_ID: My_List_ID
ADMIN_NAME: First User
ADMIN_EMAIL: [email protected]
ADMIN_PASSWORD: changeme
ROLES: [admin, user]
EMAIL_ADDRESS: [email protected]
DOMAIN: example.com

We use Mandrill to increase deliverability for email messages from the application. Provide a MANDRILL_USERNAME and MANDRILL_API_KEY.

When visitors sign up to be notified of our launch, we’ll add them to a MailChimp list. Add an environment variable for the MailChimp API key: MAILCHIMP_API_KEY. You can find the MailChimp API key under the tab for “Account” on the MailChimp website after you log in. Look for the “Api Keys and Authorized Apps” menu item.

We’ll add MAILCHIMP_LIST_ID for the ID of the mailing list we’ll set up in MailChimp. To find the list ID, on the MailChimp “Lists” page, look for the dropdown “gear” menu for the mailing list you’ve created and click “List Settings and Unique ID.” At the bottom of the List Settings page, you’ll find the unique ID for the mailing list.

If you wish, set your name, email address, and password for an administrator’s account. If you prefer, you can use the default to sign in to the application and edit the account after deployment. It is always a good idea to change the administrator’s password after the application is deployed.

Specify roles in the configuration file. You will need an “admin” role and “user” role. Remove the “VIP” role as we won’t use it.

We’ll add EMAIL_ADDRESS to provide the default sender email address we use when sending email from the application.

Finally, we’ll add DOMAIN which is also used when sending email.

All configuration values in the config/application.yml file are available anywhere in the application as environment variables. For example, ENV["GMAIL_USERNAME"] will return the string “Your_Username”.

If you prefer, you can delete the config/application.yml file and set each value as an environment variable in the Unix shell.

Set Up a Database Seed File

The db/seeds.rb file initializes the database with default values. To keep some data private, and consolidate configuration settings in a single location, we use the config/application.yml file to set environment variables and then use the environment variables in the db/seeds.rb file.

puts 'ROLES'
YAML.load(ENV['ROLES']).each do |role|
  Role.find_or_create_by_name({ :name => role }, :without_protection => true)
  puts 'role: ' << role
end
puts 'DEFAULT USERS'
user = User.find_or_create_by_email :name => ENV['ADMIN_NAME'].dup, :email => ENV['ADMIN_EMAIL'].dup, :password => ENV['ADMIN_PASSWORD'].dup, :password_confirmation => ENV['ADMIN_PASSWORD'].dup
puts 'user: ' << user.name
user.add_role :admin
user.skip_confirmation!
user.save!

The db/seeds.rb file reads a list of roles from the config/application.yml file and adds the roles to the database. In fact, any new role can be added to the roles datatable with a statement such user.add_role :superhero. Setting the roles in the db/seeds.rb file simply makes sure each role is listed and available.

You can change the administrator name, email, and password in this file but it is better to make the changes in the config/application.yml file to keep the credentials private. If you decide to include your private password in the db/seeds.rb file, be sure to add the filename to your .gitignore file so that your password doesn’t become available in your public GitHub repository.

Note that it’s not necessary to personalize the db/seeds.rb file before you deploy your app. You can deploy the app with an example user and then use the application’s “Edit Account” feature to change name, email address, and password after you log in. Use this feature to log in as an administrator and change the user name and password to your own.

Don’t overlook the user.skip_confirmation! and user.save! statements. This application uses the Devise Confirmable module to require that a user confirm a new account by clicking on a link in an email message. You won’t be sending the administrator an email message with a confirmation link so you must set the account with the user.skip_confirmation! and user.save! statements.

You may wish to include additional sample users:

user2 = User.find_or_create_by_email :name => 'Second User', :email => '[email protected]', :password => 'changeme', :password_confirmation => 'changeme'
puts 'user: ' << user2.name
user2.add_role :VIP

This will add a second user to the database with a “VIP” role.

Set the Database

Prepare the database and add the default user to the database by running the commands:

$ rake db:migrate
$ rake db:seed

Use rake db:reset if you want to empty and reseed the database.

Set the database for running tests:

$ rake db:test:prepare

If you’re not using rvm, the Ruby Version Manager, you should preface each rake command with bundle exec. You don’t need to use bundle exec if you are using rvm version 1.11.0 or newer.

Change your Application’s Secret Token

If you’ve used the Rails Composer tool to generate the application, the application’s secret token will be unique, just as with any Rails application generated with the rails new command.

However, if you’ve cloned the application directly from GitHub, it is crucial that you change the application’s secret token before deploying your application in production mode. Otherwise, people could change their session information, and potentially access your site without permission. Your secret token should be at least 30 characters long and completely random.

Get a unique secret token:

rake secret

Edit your config/initializers/secret_token.rb file to add the secret token:

RailsPrelaunchSignup::Application.config.secret_token = '...some really long, random string...'

Test the App

You can check that your app runs properly by entering the command

$ rails server

To see your application in action, open a browser window and navigate to http://localhost:3000/.

Sign in as the first user (the administrator) using:

You’ll see a navigation link for Admin. Clicking the link will display a page with a list of users at
http://localhost:3000/users.

If you want to see what the administrative dashboard looks like with many users, you can add a line to the db/seeds.rb file to create a hundred bogus users:

100.times {|i| User.create! :name => "User #{i+3}", :email => "user#{i+3}@example.com", :password => 'changeme', :password_confirmation => 'changeme'}

Then run $ rake db:reset to recreate the database and visit the site again.

Deploy to Heroku

Heroku provides low cost, easily configured Rails application hosting.

For your convenience, here is a Tutorial for Rails on Heroku. See the article for details about preparing your application to deploy to Heroku.

Be sure to set up SSL before you make your application available in production. See the Heroku documentation on SSL or use CloudFlare as described in the tutorial.

After you’ve prepared your application as described in the Tutorial for Rails on Heroku article, precompile assets, commit to git, and push to Heroku:

$ rake assets:precompile
$ git add -A
$ git commit -m "assets compiled for Heroku"
$ git push heroku master

You’ll need to set the configuration values from the config/application.yml file as Heroku environment variables. See the article Rails Environment Variables for more information.

With the figaro gem, just run:

$ rake figaro:heroku

Alternatively, you can set Heroku environment variables directly.

Here’s how to set environment variables directly on Heroku with heroku config:add.

$ heroku config:add MANDRILL_USERNAME='Your_Username' MANDRILL_API_KEY='Your_Mandrill_API_Key'
$ heroku config:add MAILCHIMP_LIST_ID='Your_List_ID'
$ heroku config:add ADMIN_NAME='First User' ADMIN_EMAIL='[email protected]' ADMIN_PASSWORD='changeme'
$ heroku config:add 'ROLES=[admin, user]'
$ heroku config:add EMAIL_ADDRESS='[email protected]' DOMAIN='example.com'

Complete Heroku deployment with:

$ heroku run rake db:migrate
$ heroku run rake db:seed

Testing

The example application contains a suite of RSpec unit tests and Cucumber scenarios and step definitions.

After installing the application, run rake -T to check that rake tasks for RSpec and Cucumber are available.

Run rake spec to run RSpec tests.

Run rake cucumber (or more simply, cucumber) to run Cucumber scenarios.

Please send the author a message, create an issue, or submit a pull request if you can contribute improved RSpec or Cucumber files.

Issues

Please create a GitHub issue if you identify any problems or have suggestions for improvements.

Where to Get Help

Your best source for help with problems is Stack Overflow. Your issue may have been encountered and addressed by others.

You can also try Rails Hotline, a free telephone hotline for Rails help staffed by volunteers.

Contributing

If you make improvements to this application, please share with others.

Send the author a message, create an issue, or fork the project and submit a pull request.

If you add functionality to this application, create an alternative implementation, or build an application that is similar, please contact me and I’ll add a note to the README so that others can find your work.

Credits

Daniel Kehoe implemented the application and wrote the tutorial.

Is the app useful to you? Follow the project on Twitter: @rails_apps
and tweet some praise. I’d love to know you were helped out by what I’ve put together.

MIT License

MIT License

Copyright © 2012 Daniel Kehoe

Useful Links

Getting Started Articles Tutorials
Ruby on Rails Analytics for Rails Rails Bootstrap
What is Ruby on Rails? Heroku and Rails Rails Foundation
Learn Ruby on Rails JavaScript and Rails RSpec Tutorial
Rails Tutorial Rails Environment Variables Rails Devise Tutorial
Ruby on Rails Tutorial for Beginners Git and GitHub with Rails Devise RSpec
Install Ruby on Rails Send Email with Rails Devise Bootstrap
Install Ruby on Rails – Mac OS X Haml and Rails Rails Membership Site with Stripe
Install Ruby on Rails – Ubuntu Rails Application Layout Rails Subscription Site with Recurly
Ruby on Rails – Nitrous.io HTML5 Boilerplate for Rails Startup Prelaunch Signup Application
Update Rails Example Gemfiles for Rails
Rails Composer Rails Application Templates
Rails Examples Rails Product Planning
Rails Starter Apps Rails Project Management

githalytics.com alpha

rails-prelaunch-signup's People

Contributors

andreapavoni avatar danielkehoe avatar jmcaffee avatar kathyonu avatar padi avatar tmock12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rails-prelaunch-signup's Issues

Question about branches

Per README section Git Branches, Rails Composer can create two branches (if the prelaunch one is 'master') when it generates this Rails Example App:

  1. Git branch for the prelaunch app
  2. Git branch for the main app

Do they have different contents? Which one is the current repository branch called master? And where is the other one on GitHub?

To fix two broken rspec specs

  1. Add "validates_confirmation_of :password" line (15) to add/models/user.rb file.
  2. Changed "false" to '!(password != "")' inside "if !persisted?" (line 19) inside app/models/user.rb file.

Change Backend into ActiveAdmin and Chart Library

Hi Daniel,

first of all i want to say thank you for your efforts in developing nice tutorials and working examples!
I've forked your app to integrate activeadmin and HighCharts library, a js one which doesn't use flash.
I need to add real data feed on the chart (now is filled with fake values).
If you want to take a look you can find it here:

https://github.com/scicco/rails-prelaunch-signup/tree/activeadmin

Maybe you can merge those changes into your app.

Hope to be useful!

Bye

Guido

MailChimp welcome email not sending

Hey - I can't get my MailChimp welcome email to send. The add_user_to_mailchimp code works and adds new users to my MailChimp list, it just doesn't send a welcome email. Maybe not technically an error on your end but is there anything you can think I might have missed?

Again, I have the list 'Visitors' set up and users are being added to it; is there anything on the MailChimp side I need to do to activate the welcome email?

  def add_user_to_mailchimp
    unless self.email.include?('@example.com')
      mailchimp = Hominid::API.new(ENV["MAILCHIMP_API_KEY"])
      list_id = mailchimp.find_list_id_by_name "Visitors"
      info = { }
      result = mailchimp.list_subscribe(list_id, self.email, info, 'html', false, true, false, true)
      Rails.logger.info("MAILCHIMP SUBSCRIBE: result #{result.inspect} for #{self.email}")
    end
  end

MailChimp API error while running migration and creating DEFAULT USERS

I've been trying to run the migration for the db and theres is an error when trying to create the email address provided for the Admin by the ENV variable.

DEFAULT USERS
user: Erik Santiago
rake aborted!
MailChimp API Error: This email address looks fake or invalid. Please enter a real email address (code -100)

I must say that I wanted to user my name and email account to create the Admin but for some reason it is not working.

Mailchimp actions on user

To avoid creating false mailchimp list entries while in development and during testing , a newly confirmed user should only be added to the mailchimp subscriber list in production.

def add_user_to_mailchimp
     return unless ENV['RAILS_ENV']=='production'
     :
end

def remove_user_from_mailchimp
    return unless ENV['RAILS_ENV']=='production'
    :
end

roles

can you show roles for each user on admin page in the table and allow admin to change/assign the roles of the users?

Can't seed the database with roles. ActiveRecord generates incorrect SQL.

I am using ruby-2.0.0-p247 on Windows 7 and rails 4.0.0

My db\seeds.rb file has this in the beginning, per the tutorial:

puts 'ROLES'
YAML.load(ENV['ROLES']).each do |role|
  Role.find_or_create_by_name({ :name => role }, :without_protection => true)
  puts 'role: ' << role
end

I run rake db:seed and this is the output:

ROLES
rake aborted!
PG::UndefinedTable: ERROR:  missing FROM-clause entry for table "name"
LINE 1: SELECT  "roles".* FROM "roles"  WHERE "name"."name" = 'admin...
                                              ^
: SELECT  "roles".* FROM "roles"  WHERE "name"."name" = 'admin'  ORDER BY "roles"."id" ASC LIMIT 1

I don't understand why the SQL WHERE clause comes out asWHERE "name"."name". I think it should be WHERE "role"."name"

I have no table called "name" in the database. Only a table called "role", as it should be. I guess I'm just going to seed by hand. But why is ActiveRecord generating this SQL?

Bulk invitations sent to already confirmed users

The problem is that the confirmation_token is emptied when the user confirms and the bulk_invite filters on empty confirmation_tokens only:

users = User.where(:confirmation_token => nil).order(:created_at).limit(params[:quantity])

Simply adding :encrypted_password => nil to the where cluase solves the problem:

users = User.where(:confirmation_token => nil, :encrypted_password => nil).order(:created_at).limit(params[:quantity])

Unable to save User after adding modal thank you

My trouble came after overriding the 'create' method for Registration_Controller.rb

I already added in the javascript to display the modal thank you, so when i input a user email (a valid one), the html errors out telling me that the email field can't be blank.

According to the logs, there is a rollback transaction:

Started POST "/users" for 127.0.0.1 at 2014-06-22 03:24:01 -0700
Processing by RegistrationsController#create as /
Parameters: {"user"=>{"email"=>"[email protected]"}}
+++ resource is: User id: nil, email: "", encrypted_password: "", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, created_at: nil, updated_at: nil, name: nil, confirmation_token: nil, confirmed_at: nil, confirmation_sent_at: nil, unconfirmed_email: nil

(0.1ms) begin transaction
(0.1ms) rollback transaction
+++ resource.save: false
(0.0ms) begin transaction
(0.0ms) rollback transaction
Rendered devise/registrations/new.html.erb (6.4ms)
Completed 200 OK in 109ms (Views: 16.6ms | ActiveRecord: 0.9ms)

It seems resource.save is always false. Any ideas?

Tests are not running correctly after commit aa03a8951c

Running tests for the second time after last commit will yield 5 validation errors in the users_controller_spec and user_mailer_spec:

Failures:

  1) UserMailer should be delivered to the email address provided
     Failure/Error: @user = FactoryGirl.create(:user, email: "[email protected]")
     ActiveRecord::RecordInvalid:
       Validation failed: Email has already been taken
     # ./spec/mailers/user_mailer_spec.rb:5:in `block (2 levels) in <top (required)>'

  2) UserMailer should contain the correct message in the mail body
     Failure/Error: @user = FactoryGirl.create(:user, email: "[email protected]")
     ActiveRecord::RecordInvalid:
       Validation failed: Email has already been taken
     # ./spec/mailers/user_mailer_spec.rb:5:in `block (2 levels) in <top (required)>'

  3) UserMailer should have the correct subject
     Failure/Error: @user = FactoryGirl.create(:user, email: "[email protected]")
     ActiveRecord::RecordInvalid:
       Validation failed: Email has already been taken
     # ./spec/mailers/user_mailer_spec.rb:5:in `block (2 levels) in <top (required)>'

  4) UsersController GET 'show' should be successful
     Failure/Error: @user = FactoryGirl.create(:user)
     ActiveRecord::RecordInvalid:
       Validation failed: Email has already been taken
     # ./spec/controllers/users_controller_spec.rb:6:in `block (2 levels) in <top (required)>'

  5) UsersController GET 'show' should find the right user
     Failure/Error: @user = FactoryGirl.create(:user)
     ActiveRecord::RecordInvalid:
       Validation failed: Email has already been taken
     # ./spec/controllers/users_controller_spec.rb:6:in `block (2 levels) in <top (required)>'

Going through the last commit, I found that the DatabaseCleaner had been removed from the spec_helper.rb file. Changing the file to the previous version (https://github.com/RailsApps/rails-prelaunch-signup/blob/884c0d26a597d663b6775496893cb32f6c7a403d/spec/spec_helper.rb) solved the issue.

brakeman needs rails 3.2.8 to be happy

Verified previous fixes, but brakeman (security scanner) also wants Rails 3.2.8 with its security fixes.

After you upgrade Gemfile from 3.2.6 to 3.2.8, you get this:+-------------------+-------+
| Scanned/Reported | Total |
+-------------------+-------+
| Controllers | 1 |
| Models | 0 |
| Templates | 1 |
| Errors | 0 |
| Security Warnings | 0 (0) |
+-------------------+-------+

+--------------+-------+
| Warning Type | Total |
+--------------+-------+
+--------------+-------+

+SECURITY WARNINGS+

+------------------+
| General Warnings |
+------------------+
| [NONE] |
+------------------+

Gibbon::MailChimpError at /users

I am really not sure where to start on this issue or how to begin to correct this. I have search stack overflow and google an not found the answer.

When I input user to request invite, I get the Error:

Gibbon::MailChimpError at /users
This email address looks fake or invalid. Please enter a real email address

I can only assume that this happened after I did the final step, which was to migrate the db for heroku. Please advise.

Failing test with Capybara 2.1.0

With the upgrade of Capybara 2.1.0 I had test failing right out the gate. Needed to add the following to features/support/env.rb

Capybara.ignore_hidden_elements = false

Also, on the testing front. It would be helpful to include Test Setup in the ReadMe. Took a while to figure out some of the cucumber failing test for bad logins. The password in the user.rb factory needs to be in sync with password in cucumber steps when creating a user with only email address.

Thanks for all you work.

Use gem capybara-webkit instead of Selenium?

Why aren't we using the faster and more normal capybara-webkit instead of Selenium?

I presume (with either) we would be testing Javascript code.

Many Cucumber features are failing (for me) without a Firefox binary installed on my Linux box:

Could not find Firefox binary (os=linux). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path= (Selenium::WebDriver::Error::WebDriverError)
      ./features/step_definitions/user_steps.rb:47:in `/^I am not logged in$/'

cucumber encounters TypeError with mysql

Stack traces

When I visit the users page                                      # features/step_definitions/admin_steps.rb:9
  can't convert Date into String (TypeError)
  ./app/controllers/users_controller.rb:38:in `parse'
  ./app/controllers/users_controller.rb:38:in `block in create_chart'
  ./app/controllers/users_controller.rb:37:in `each'
  ./app/controllers/users_controller.rb:37:in `create_chart'
  ./app/controllers/users_controller.rb:7:in `index'
  ./features/step_definitions/admin_steps.rb:10:in `/^I visit the users page$/'
  features/admin/send_invitations.feature:9:in `When I visit the users page'

and

When I visit the users page                        # features/step_definitions/admin_steps.rb:9
  can't convert Date into String (TypeError)
  ./app/controllers/users_controller.rb:38:in `parse'
  ./app/controllers/users_controller.rb:38:in `block in create_chart'
  ./app/controllers/users_controller.rb:37:in `each'
  ./app/controllers/users_controller.rb:37:in `create_chart'
  ./app/controllers/users_controller.rb:7:in `index'
  ./features/step_definitions/admin_steps.rb:10:in `/^I visit the users page$/'
  features/admin/view_progress.feature:9:in `When I visit the users page'

produced by generating a new app with

rails new rails-prelaunch-signup -m https://raw.github.com/RailsApps/rails3-application-templates/master/rails-prelaunch-signup-template.rb -T

using defaults documented in the tutorial

errors with rvm installing starter app

Trying to install the starter app gives me this error when it gets to the line extras Banning spiders by modifying 'public/robots.txt'

https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-bootstrap-devise-cancan-template.rb:1084:in rescue in apply': RVM ruby lib is currently unavailable. (RuntimeError) from https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-bootstrap-devise-cancan-template.rb:1079:inapply'
from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/thor-0.16.0/lib/thor/actions.rb:221:in instance_eval' from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/thor-0.16.0/lib/thor/actions.rb:221:inapply'
from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/railties-3.2.8/lib/rails/generators/app_base.rb:109:in apply_rails_template' from (eval):1:inapply_rails_template'
from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/thor-0.16.0/lib/thor/task.rb:27:in run' from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/thor-0.16.0/lib/thor/invocation.rb:120:ininvoke_task'
from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/thor-0.16.0/lib/thor/invocation.rb:126:in block in invoke_all' from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/thor-0.16.0/lib/thor/invocation.rb:126:ineach'
from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/thor-0.16.0/lib/thor/invocation.rb:126:in map' from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/thor-0.16.0/lib/thor/invocation.rb:126:ininvoke_all'
from /Users/ml/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/thor-0.16.0/lib/thor/group.rb:238:in dispatch' from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/thor-0.16.0/lib/thor/base.rb:425:instart'
from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/railties-3.2.8/lib/rails/commands/application.rb:38:in <top (required)>' from /Users/m/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:inrequire'
from /Users/m/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in require' from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/railties-3.2.8/lib/rails/cli.rb:15:in<top (required)>'
from /Users/m/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in require' from /Users/m/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:inrequire'
from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/gems/railties-3.2.8/bin/rails:7:in <top (required)>' from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/bin/rails:19:inload'
from /Users/m/.rvm/gems/ruby-1.9.3-rc1@ruby193/bin/rails:19:in `

'

Generation encounters missing file

While generating two branches (in this way):

Git branch for the prelaunch app?
          2)  master
Git branch for the main app?
          2)  wip (work-in-progress)

Rails Composer emits a message:

prelaunch  Unable to obtain features/users/sign_up.feature from the repo https://raw.github.com/RailsApps/rails-prelaunch-signup/master/

Currently, the file does not exist in that directory.

Furthermore, Rails Composer does not halt—but should it, in this kind of case?

Duplicate Email is not getting validated after couple of times

When same email id is given for registration, in the beginning it worked fine saying "email has already taken" but after couple of times the same is not working. I looked in to the code in RegistrationController.rb , this condition would fail (resource.active_for_authentication?) and else part is executed (expire_session_data_after_sign_in!
(render(:partial => 'thankyou', :layout => false) && return) if request.xhr?) this is trying to delete the user, which is wrong...!

RVM issue

I've previously installed the simple bootstrap+CanCan+Devise without any issues and simply said 'No' to the local rvm request.
When trying to install the prelaunch-signup, I get the following error:
extras recipe creating project-specific rvm gemset and .rvmrc
https://raw.github.com/RailsApps/rails3-application-templates/master/rails-prelaunch-signup-template.rb:1906:in `rescue in apply': RVM gem is currently unavailable. (RuntimeError)

I don't want to use the RVM gem, and the rails3-boostrap-cancan composer didn't have these issues.

How can I fix this? (short of installing the RVM gem)

Devise views not working in production

The app's custom devise views don't seem to be working in production for me.

In development, everything works fine. I see the devise views I'm expecting (from the views/devise folder).

However, as soon as I switch to production, the app starts using the default device gem views.

Any ideas as to what might be going on? I'm assuming this is something really simple that I'm failing to notice.

Thanks!

The confirmati​on email do not carry current Password/ User unable to set his password

The confirmation email for a visitor donot carry the current password, because of this reason user will not be able to change his password.
Using confirmation link directly it gets logged in and edit account link is given to the use but he can't change his password. Is there any step in between confirmation link and edit account where user sets his password.

Not adding user to Mailchimp List

Cannot get application to add users to the Mailchimp List. I have configured heroku for api keys as instructed and have modified my .bashrc file.

Modal error rerenders whole page beneath modal (same behavior if class = modal fade)

Hi,
thanks for the great work!
The Modal error Handling seems to have an issue. If I just press "Request Invitation" without providing an email, I get an error inside the modal. This is defined by

<div id =" request-invite" class="modal" style="display: <%= @user.errors.any? ? 'block' : 'none'; %>

So far this is great!

I now added some pictures to the page (beneath the modal) wrapped in a seperate div, but on error it will render the whole page again. see attached image.

Seems like the same behavior when I set ...class "modal fade" (I would love to have some transition).

I tried for the last 5 Days to rewrite the modal dialog to use Rails build in ajax (remote => true). But I just could not get it to work.

Do you have any suggestion, how I can fix the error handling to only prompt the error and not misbehave like in the screenshot?

Thank you so much!
joh
Bildschirmfoto 2012-12-10 um 11.08.16.png

Errors thrown when confirmation link clicked twice

After user getting a confirmation email with a link (authentication token ) if same is clicked once user is getting logged-in directly and if user clicks again following errors are thrown:
ActionView::Template::Error (undefined method errors' for nil:NilClass): 1: <h2>Resend confirmation instructions</h2> 2: 3: <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %> 4: <%= devise_error_messages! %> 5: 6: <div><%= f.label :email %><br /> 7: <%= f.email_field :email %></div> app/controllers/confirmations_controller.rb:41:inshow'

Cannot handle error in sign up

When user signs up via "Request Invitation" , if there's an error such as duplicate email, RegistrationController.create doesn't return an xhr.error

(render(:partial => 'thankyou', :layout => false) && return) if request.xhr?

And thus this code in application.js doesn't handle error correctly.

$.ajax({
type: "POST",
url: "/users",
data: dataString,
success: function(data) {
$('#request-invite').html(data);
loadSocial();
},
});

and this isn't called:

if ($('.alert-error').length > 0) {
$("#request-invite").modal('toggle');
}

Couldn't load application.yaml

This was the last step of the prelaunch installation that I reached...

  remove    config/application.example.yml

...and then...

  The template 
  [https://raw.github.com/RailsApps/rails-composer/master/composer.rb] 
  could not be loaded. 
  Error: Could not find "path_to_app/config/application.yml" in any of your 
  source paths.
  Your current source paths are: 
  home-directory/.rvm/gems/ruby-1.9.3-p194@rails328/gems/
  railties-3.2.11/lib/rails/generators/rails/app/templates

App crashes on remove_user_from_mailchimp if user doesn't exist on mailing list

If the user has already unsubscribed from the mailchimp mailing list so that they are no longer a member of the list, and then goes to delete his account from the rails prelaunch signup application, the app crashes because it isn't able to successfully unsubscribe the user. What would be the best way to prevent this exception? Perhaps first check to see if the user is a member of the mailing before attempting to unsubscribe the user?

NameError: uninitialized constant RailsPrelaunchSignup

I had an installation issue but sorted that out. Now right after I did

'bundle install'

http://localhost:3000/ or local.dev (with Pow) gave me this error:

~/projects/rails/learn/market/config/routes.rb:1:in `<top (required)>'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:40:in `each'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:40:in `load_paths'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:16:in `reload!'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:26:in `block in updater'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/activesupport-3.2.8/lib/active_support/file_update_checker.rb:78:in `call'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/activesupport-3.2.8/lib/active_support/file_update_checker.rb:78:in `execute'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:27:in `updater'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
~/.rvm/gems/ruby-1.9.3-p194@market/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
~/projects/rails/learn/market/config/environment.rb:5:in `<top (required)>'
~/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
~/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
~/projects/rails/learn/market/config.ru:3:in `block in <main>'
~/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/builder.rb:4:in `instance_eval'
~/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/builder.rb:4:in `initialize'
~/projects/rails/learn/market/config.ru:1:in `new'
~/projects/rails/learn/market/config.ru:1:in `<main>'
~/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/server.rb:50:in `eval'
~/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/server.rb:50:in `load_config'
~/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/server.rb:43:in `initialize'
~/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/server.rb:13:in `new'
~/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/server.rb:13:in `run'
~/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/bin/nack_worker:4:in `<main>'  

I googled and stumbled upon 8 results with nothing obvious. I'm working on getting through this one and will share anything here.

CLOSE button is disable when error in Request Invitation dialog box

Want to verify that other people see this condition too.

Using RailsApp's Startup Prelaunch Signup App

Entered "Request Invitation" email already used, get error and disabled
CLOSE button and disable X in top right corner. Is that correct?

i have to close the tab in the browser to get rid of the dialog box.

Devise cannot build resource

The request invite form shows Email can't be blank message even with a valid email. Devise is not being able to build resource from the params hash.

Rails 4 `attr_accessible`

class User < ActiveRecord::Base
rolify
attr_accessible :role_ids, :as => :admin
attr_accessible :provider, :uid, :name, :email

validates_presence_of :name
def self.create_with_omniauth(auth)
create! do |user|

Method 'add_user_to_mailchimp' missing after invitation

I´m getting the following error after invitation button is clicked:

Parameters: {"user"=>{"email"=>"[email protected]"}}
(0.1ms) begin transaction
User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = '[email protected]' LIMIT 1
SQL (2.7ms) INSERT INTO "users" ("confirmation_sent_at", "confirmation_token", "confirmed_at", "created_at", "current_sign_in_at", "current_sign_in_ip", "email", "encrypted_password", "last_sign_in_at", "last_sign_in_ip", "name", "remember_created_at", "reset_password_sent_at", "reset_password_token", "sign_in_count", "unconfirmed_email", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ["confirmation_sent_at", nil], ["confirmation_token", nil], ["confirmed_at", nil], ["created_at", Tue, 24 Feb 2015 05:57:33 BRT -03:00], ["current_sign_in_at", nil], ["current_sign_in_ip", nil], ["email", "[email protected]"], ["encrypted_password", ""], ["last_sign_in_at", nil], ["last_sign_in_ip", nil], ["name", nil], ["remember_created_at", nil], ["reset_password_sent_at", nil], ["reset_password_token", nil], ["sign_in_count", 0], ["unconfirmed_email", nil], ["updated_at", Tue, 24 Feb 2015 05:57:33 BRT -03:00] rollback transaction
Completed 500 Internal Server Error in 1923ms

Gibbon::MailChimpError - Signup disabled for "[email protected]":
(gem) gibbon-1.1.5/lib/gibbon/api_category.rb:47:in call' (gem) gibbon-1.1.5/lib/gibbon/api_category.rb:57:inmethod_missing'
app/models/user.rb:66:in `add_user_to_mailchimp'
.....

private
def add_user_to_mailchimp
return if email.include?(ENV['ADMIN_EMAIL'])
mailchimp = Gibbon::API.new(ENV['MAILCHIMP_API_KEY'])
result = mailchimp.lists.subscribe({
:id => ENV['MAILCHIMP_LIST_ID'],
:email => {:email => self.email},
:double_optin => false,
:update_existing => true,
:send_welcome => true
})
Rails.logger.info("Subscribed #{self.email} to MailChimp") if result
end

All variables are set on application.yml and the method is correct at user.rb. What could be causing this ?
thank you

database.yml not found

git clone git://github.com/RailsApps/rails-prelaunch-signup.git, I cloned the project from the given link and ran bundle install.

I am getting the following errors:

C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/application/configuration.rb:115:in read': No such file or directory - D:/work/rails-prelaunch-signup/config/database.yml (Er rno::ENOENT) from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/application/configuration.rb:115:indatabase_configuration'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.5/lib/active_record/railtie.rb:78:in block (2 levels) in <class:Railtie>' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.5/lib/active_support/lazy_load_hooks.rb:36:ininstance_eval'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.5/lib/active_support/lazy_load_hooks.rb:36:in execute_hook' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.5/lib/active_support/lazy_load_hooks.rb:26:inblock in on_load'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.5/lib/active_support/lazy_load_hooks.rb:25:in each' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.5/lib/active_support/lazy_load_hooks.rb:25:inon_load'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.5/lib/active_record/railtie.rb:74:in block in <class:Railtie>' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/initializable.rb:30:ininstance_exec'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/initializable.rb:30:in run' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/initializable.rb:55:inblock in run_initializers'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/initializable.rb:54:in each' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/initializable.rb:54:inrun_initializers'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/application.rb:136:in initialize!' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/railtie/configurable.rb:30:inmethod_missing'
from D:/work/rails-prelaunch-signup/config/environment.rb:5:in <top (required)>' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:251:inrequire'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:251:in block in require' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:236:inload_dependency'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:251:in require' from D:/work/rails-prelaunch-signup/config.ru:4:inblock in

'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in instance_eval' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:ininitialize'
from D:/work/rails-prelaunch-signup/config.ru:1:in new' from D:/work/rails-prelaunch-signup/config.ru:1:in'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in eval' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:inparse_file'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:200:in app' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/commands/server.rb:46:inapp'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:301:in wrapped_app' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:252:instart'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/commands/server.rb:70:in start' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/commands.rb:55:inblock in <top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/commands.rb:50:in tap' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.5/lib/rails/commands.rb:50:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in'

Button Style in new.html.erb

In rails-prelaunch-signup / app / views / devise / registrations / new.html.erb

I think on line 12, you meant to have "btn btn-success" instead of "btn.btn-success".

Reset password allows login without confirmation

If a user requests an invite and users password reminders, they are able to reset the password without the admin first approving them (thus circumventing the approval process). I believe it is because devise automatically sets the user to confirmed when they reset the password.

I used this code on my site and found that about 10% of users did this. I'd like to address this bug so I'd love to hear what you suggest.

Problem with :confirmable and :invitable

I have followed the tutorial steps exactly, as far as I am aware, and I have two issues:

  1. Including ":invitable" in the user model causes all sorts of problems. I had to include the gem 'devise_invitable'

  2. I am getting this error:

Scenario: User signs up with valid data # features/visitors/request_invitation.feature:18
When I request an invitation with valid user data # features/step_definitions/visitor_steps.rb:42
undefined local variable or method confirmed_at' for #<User:0x007fe7c36bddb8> (NameError) ./app/models/user.rb:29:inactive_for_authentication?'
./features/step_definitions/visitor_steps.rb:9:in invitation_request' ./features/step_definitions/visitor_steps.rb:43:in/^I request an invitation with valid user data$/'
features/visitors/request_invitation.feature:19:in `When I request an invitation with valid user data'

I followed some advice in gett8ing :confirmable to work in Devise v2.0 by creating the migration:

class AddConfirmableToDeviseV1 < ActiveRecord::Migration
def change
change_table(:users) do |t|
t.string :confirmation_token
t.datetime :confirmed_at
t.datetime :confirmation_sent_at
end
add_index :users, :confirmation_token, :unique => true
end
end

and running rake db:migrate. However, this has not resolved the issue. Any help on both these issues would be greatly appreciated.

Cannot log in as admin user ([email protected])

I'm following the rails pre-launch tutorial and I'm to the Feature: View Progress section.
My cucumber tests are failing AND I'm unable to login to the app as the admin user. When I login, the next page states 'Your account is not active."

I've pulled down rails-prelaunch-signup and compared the code with what I currently have but nothing jumps out as being different.

[email protected] does have the admin role but the app still redirects to the devise/registrations#new screen.

Using gemset and unable to install Rails 4.1.0

I created the suggested rvm gemset within the tutorial and then attempted to install Rails version 4.1.0 (as indicated within the composer tool) and returned the following error in my terminal:

gem install rails -v 4.1.0
ERROR: While executing gem ... (Gem::Exception)
Invalid spec cache file in /Users/RAI/.gem/specs/rubygems.org%443/specs.4.8

Note that I am still fairly new with Rails environments and ran a google search which didn't return any useful information. Also note that the rvm gemset that I am using is configured to ruby 2.0.0p481 as indicated in the tutorial.

Thanks and sorry if I missed anything,

Cucumber tests fail

Are the cucumber tests supposed to work?

Using the default profile...
Feature: Send Invitations
  As the owner of the site
  I want to send invitations to visitors who have requested invitations
  so users can try the site

  Scenario: Administrator sends invitation                           # features/admin/send_invitations.feature:6
    Given I request an invitation with valid user data               # features/step_definitions/visitor_steps.rb:42
      Unable to find field "Email" (Capybara::ElementNotFound)
      ./features/step_definitions/visitor_steps.rb:8:in `invitation_request'
      ./features/step_definitions/visitor_steps.rb:43:in `/^I request an invitation with valid user data$/'
      features/admin/send_invitations.feature:7:in `Given I request an invitation with valid user data'
    And I am logged in as an administrator                           # features/step_definitions/admin_steps.rb:1
    When I visit the users page                                      # features/step_definitions/admin_steps.rb:9
    And I click a link "send invitation"                             # features/step_definitions/admin_steps.rb:13
    And I open the email with subject "Confirmation instructions"    # features/step_definitions/email_steps.rb:80
    Then I should see "confirm your email address" in the email body # features/step_definitions/email_steps.rb:108

Feature: View Progress
  As the owner of the site
  I want to know how many visitors have requested invitations
  so I can know if my offer is popular

  Scenario: Administrator views list of users          # features/admin/view_progress.feature:6
    Given I request an invitation with valid user data # features/step_definitions/visitor_steps.rb:42
      Unable to find field "Email" (Capybara::ElementNotFound)
      ./features/step_definitions/visitor_steps.rb:8:in `invitation_request'
      ./features/step_definitions/visitor_steps.rb:43:in `/^I request an invitation with valid user data$/'
      features/admin/view_progress.feature:7:in `Given I request an invitation with valid user data'
    And I am logged in as an administrator             # features/step_definitions/admin_steps.rb:1
    When I visit the users page                        # features/step_definitions/admin_steps.rb:9
    Then I should see a list of users                  # features/step_definitions/admin_steps.rb:17

  Scenario: User cannot view list of users     # features/admin/view_progress.feature:12
    Given I am logged in                       # features/step_definitions/user_steps.rb:50
    When I visit the users page                # features/step_definitions/admin_steps.rb:9
    Then I should see an access denied message # features/step_definitions/admin_steps.rb:21
      expected to find text "Not authorized as an administrator" in "Rails Prelaunch Signup Login Sign up × You need to sign in or sign up before continuing. Sign in Email Password Remember me Forgot your password?" (RSpec::Expectations::ExpectationNotMetError)
      ./features/step_definitions/admin_steps.rb:22:in `/^I should see an access denied message$/'
      features/admin/view_progress.feature:15:in `Then I should see an access denied message'

Feature: Sign in
  In order to get access to protected sections of the site
  A user
  Should be able to sign in

  Scenario: User is not signed up         # features/users/sign_in.feature:6
    Given I do not exist as a user        # features/step_definitions/user_steps.rb:59
    When I sign in with valid credentials # features/step_definitions/user_steps.rb:69
    Then I see an invalid login message   # features/step_definitions/user_steps.rb:177
    And I should be signed out            # features/step_definitions/user_steps.rb:139

  Scenario: User signs in successfully      # features/users/sign_in.feature:12
    Given I exist as a user                 # features/step_definitions/user_steps.rb:55
    And I am not logged in                  # features/step_definitions/user_steps.rb:46
    When I sign in with valid credentials   # features/step_definitions/user_steps.rb:69
    Then I see a successful sign in message # features/step_definitions/user_steps.rb:149
      expected to find text "Signed in successfully." in "Rails Prelaunch Signup Login Sign up × Invalid email or password. Sign in Email Password Remember me Forgot your password?" (RSpec::Expectations::ExpectationNotMetError)
      ./features/step_definitions/user_steps.rb:150:in `/^I see a successful sign in message$/'
      features/users/sign_in.feature:16:in `Then I see a successful sign in message'
    When I return to the site               # features/step_definitions/user_steps.rb:107
    Then I should be signed in              # features/step_definitions/user_steps.rb:133

  Scenario: User enters wrong email     # features/users/sign_in.feature:20
    Given I exist as a user             # features/step_definitions/user_steps.rb:55
    And I am not logged in              # features/step_definitions/user_steps.rb:46
    When I sign in with a wrong email   # features/step_definitions/user_steps.rb:111
    Then I see an invalid login message # features/step_definitions/user_steps.rb:177
    And I should be signed out          # features/step_definitions/user_steps.rb:139

  Scenario: User enters wrong password   # features/users/sign_in.feature:27
    Given I exist as a user              # features/step_definitions/user_steps.rb:55
    And I am not logged in               # features/step_definitions/user_steps.rb:46
    When I sign in with a wrong password # features/step_definitions/user_steps.rb:116
    Then I see an invalid login message  # features/step_definitions/user_steps.rb:177
    And I should be signed out           # features/step_definitions/user_steps.rb:139

Feature: Sign out
  To protect my account from unauthorized access
  A signed in user
  Should be able to sign out

  Scenario: User signs out                 # features/users/sign_out.feature:6
    Given I am logged in                   # features/step_definitions/user_steps.rb:50
    When I sign out                        # features/step_definitions/user_steps.rb:74
    Then I should see a signed out message # features/step_definitions/user_steps.rb:173
      expected to find text "Signed out successfully." in "Rails Prelaunch Signup Login Sign up Want in? Request invite" (RSpec::Expectations::ExpectationNotMetError)
      ./features/step_definitions/user_steps.rb:174:in `/^I should see a signed out message$/'
      features/users/sign_out.feature:9:in `Then I should see a signed out message'
    When I return to the site              # features/step_definitions/user_steps.rb:107
    Then I should be signed out            # features/step_definitions/user_steps.rb:139

Feature: Sign up
  In order to get access to protected sections of the site
  As a user
  I want to be able to sign up

  Background:                # features/users/sign_up.feature:6
    Given I am not logged in # features/step_definitions/user_steps.rb:46

  Scenario: User signs up with valid data          # features/users/sign_up.feature:9
    When I sign up with valid user data            # features/step_definitions/user_steps.rb:78
      Unable to find field "Email" (Capybara::ElementNotFound)
      ./features/step_definitions/user_steps.rb:33:in `sign_up'
      ./features/step_definitions/user_steps.rb:80:in `/^I sign up with valid user data$/'
      features/users/sign_up.feature:10:in `When I sign up with valid user data'
    Then I should see a successful sign up message # features/step_definitions/user_steps.rb:153

  Scenario: User signs up with invalid email   # features/users/sign_up.feature:13
    When I sign up with an invalid email       # features/step_definitions/user_steps.rb:83
      Unable to find field "Email" (Capybara::ElementNotFound)
      ./features/step_definitions/user_steps.rb:33:in `sign_up'
      ./features/step_definitions/user_steps.rb:86:in `/^I sign up with an invalid email$/'
      features/users/sign_up.feature:14:in `When I sign up with an invalid email'
    Then I should see an invalid email message # features/step_definitions/user_steps.rb:157

Feature: Edit User
  As a registered user of the website
  I want to edit my user profile
  so I can change my username

  Scenario: I sign in and edit my account       # features/users/user_edit.feature:6
    Given I am logged in                        # features/step_definitions/user_steps.rb:50
    When I edit my account details              # features/step_definitions/user_steps.rb:121
      Unable to find link "Edit account" (Capybara::ElementNotFound)
      ./features/step_definitions/user_steps.rb:122:in `/^I edit my account details$/'
      features/users/user_edit.feature:8:in `When I edit my account details'
    Then I should see an account edited message # features/step_definitions/user_steps.rb:181

Feature: Show Users
  As a visitor to the website
  I want to see registered users listed on the homepage
  so I can know if the site has users

Feature: Request Invitation
  As a visitor to the website
  I want to request an invitation 
  so I can be notified when the site is launched

  Background:                # features/visitors/request_invitation.feature:6
    Given I am not logged in # features/step_definitions/user_steps.rb:46

  Scenario: User views home page                    # features/visitors/request_invitation.feature:9
    When I visit the home page                      # features/step_definitions/visitor_steps.rb:12
    Then I should see a button "Request Invitation" # features/step_definitions/visitor_steps.rb:16
      expected to find button "Request Invitation" but there were no matches. Also found "", which matched the selector but not all filters. (Capybara::ExpectationNotMet)
      ./features/step_definitions/visitor_steps.rb:17:in `/^I should see a button "([^\"]*)"$/'
      features/visitors/request_invitation.feature:11:in `Then I should see a button "Request Invitation"'

  Scenario: User views invitation request form    # features/visitors/request_invitation.feature:13
    When I visit the home page                    # features/step_definitions/visitor_steps.rb:12
    And I click a button "Request Invitation"     # features/step_definitions/visitor_steps.rb:20
      Unable to find button "Request Invitation" (Capybara::ElementNotFound)
      ./features/step_definitions/visitor_steps.rb:21:in `/^I click a button "([^"]*)"$/'
      features/visitors/request_invitation.feature:15:in `And I click a button "Request Invitation"'
    Then I should see a form with a field "Email" # features/step_definitions/visitor_steps.rb:24

  Scenario: User signs up with valid data                 # features/visitors/request_invitation.feature:18
    When I request an invitation with valid user data     # features/step_definitions/visitor_steps.rb:42
      Unable to find field "Email" (Capybara::ElementNotFound)
      ./features/step_definitions/visitor_steps.rb:8:in `invitation_request'
      ./features/step_definitions/visitor_steps.rb:43:in `/^I request an invitation with valid user data$/'
      features/visitors/request_invitation.feature:19:in `When I request an invitation with valid user data'
    Then I should see a message "Thank You"               # features/step_definitions/visitor_steps.rb:28
    And my email address should be stored in the database # features/step_definitions/visitor_steps.rb:32
    And my account should be unconfirmed                  # features/step_definitions/visitor_steps.rb:37

  Scenario: User signs up with invalid email           # features/visitors/request_invitation.feature:24
    When I request an invitation with an invalid email # features/step_definitions/visitor_steps.rb:46
      Unable to find field "Email" (Capybara::ElementNotFound)
      ./features/step_definitions/visitor_steps.rb:8:in `invitation_request'
      ./features/step_definitions/visitor_steps.rb:48:in `/^I request an invitation with an invalid email$/'
      features/visitors/request_invitation.feature:25:in `When I request an invitation with an invalid email'
    Then I should see an invalid email message         # features/step_definitions/user_steps.rb:157

Failing Scenarios:
cucumber features/admin/send_invitations.feature:6 # Scenario: Administrator sends invitation
cucumber features/admin/view_progress.feature:6 # Scenario: Administrator views list of users
cucumber features/admin/view_progress.feature:12 # Scenario: User cannot view list of users
cucumber features/users/sign_in.feature:12 # Scenario: User signs in successfully
cucumber features/users/sign_out.feature:6 # Scenario: User signs out
cucumber features/users/sign_up.feature:9 # Scenario: User signs up with valid data
cucumber features/users/sign_up.feature:13 # Scenario: User signs up with invalid email
cucumber features/users/user_edit.feature:6 # Scenario: I sign in and edit my account
cucumber features/visitors/request_invitation.feature:9 # Scenario: User views home page
cucumber features/visitors/request_invitation.feature:13 # Scenario: User views invitation request form
cucumber features/visitors/request_invitation.feature:18 # Scenario: User signs up with valid data
cucumber features/visitors/request_invitation.feature:24 # Scenario: User signs up with invalid email

15 scenarios (12 failed, 3 passed)
62 steps (12 failed, 20 skipped, 30 passed)
0m2.773s
rake aborted!
Command failed with status (1): [/home/mrichman/.rvm/rubies/ruby-2.0.0-p0/b...]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.