Title: Error in Ruby logs -> ActiveRecor181a:6c1c:918f:f3a4:2e8c:61d6:1a08:6b16RecordNotFound (Couldn't find Plan with 'id'=1):
Tags: ruby-on-rails;ruby;git;heroku;activerecord
Question: I a having issues with Heroku, I have a project which is working fine on C9 but when I push to Heroku it gives me the following error in the logs  

```
  ActiveRecor181a:6c1c:918f:f3a4:2e8c:61d6:1a08:6b16RecordNotFound (Couldn't find Plan with 'id'=1)
```

resulting in following error on my homepage -> 

```
  The page you were looking for doesn't exist.
```

You may have mistyped the address or the page may have moved.

home.html.erb

```<div class="row"&gt;
    <div class="col-md-6"&gt;
        <div class="well"&gt;
            <h3 class="text-center"&gt;Basic membership</H3&gt;
            <h4&gt;Hier inschrijven voor alle leden van het gezin.</h4&gt;
            <br /&gt;
            <%= link_to "Sign up free", new_user_registration_path(plan: Plan.find(1).id), class: 'btn btn-primary btn-lg btn-block' %&gt;
        </div&gt;
    </div&gt;

     <div class="col-md-6"&gt;
         <div class="well"&gt;
             <h3 class="text-center"&gt;Premium membership</h3&gt;
             <h4&gt;Niet gebruiken dit is een test object.</h4&gt;
             <br /&gt;
             <%= link_to "Sign up for premium plan", new_user_registration_path(plan: Plan.find(2).id), class: 'btn btn-success btn-lg btn-block' %&gt;
         </div&gt;
```

pages_controller 

```class PagesController < ApplicationController
    def home
        @basic_plan = Plan.find(1)
        @pro_plan = Plan.find(2)
    end

    def about
    end
end
```

I am using devise gem for storing the users as can be seen in the following snippet 

```Rails.application.routes.draw do
  devise_for :users
  resources :contacts
  get '/about' =&gt; 'pages#about'
  root 'pages#home'
```

everything is backed up to GitHub from master branch and after that pushed to Heroku via master again... It can't find the solution, help would be welcome :)

Comment: C9 database would have data in `plans` table which is not available to Heroku. You need to create these data in your production db.

Here is the accepted answer: Your Plan table may be empty or plan created with any other id, you should export DB from ```C9``` and import it to ```Heroku```

and as an extra note you can't depend on ids, ```id``` column is auto increment and if you created some planes and deleted after, then new created plans may start with id=5 as an example, and if you even force the id you still shouldn't do that.

My suggestion if you have a plan name or any other uniq column for Plan table use it:

```Plan.find_by_name('plan_name').id
```

or even use:  (in case you are sure you free plan is always created first)

```Plan.order('id').first
Plan.order('id').last
```


Here is another answer: ```
  ActiveRecor181a:6c1c:918f:f3a4:2e8c:61d6:1a08:6b16RecordNotFound (Couldn't find Plan with 'id'=1)
```

Clearly, you don't have ```Plan``` with ```id = 1``` in your database

and finding record with hardcoded id is bad practice:

```new_user_registration_path(plan: Plan.find(1).id)
```

You can do the same with 

```new_user_registration_path(plan: 1)
```

```Plan.find(1).id``` will return you ```1``` only

OR

```new_user_registration_path(plan: Plan.find_by_name('Premium').try(:id))
```

NOTE: Also make sure you have created ```Plans``` on your production db 

Comment for this answer: yeah, I assigned variables to the plan, I just tried it through hardcoding to see of that was a part of the error that did not seem the problem will change it back to the variable name :). Thx for the input. And I indeed do not have my db properly migrated to Heroku pretty new to this stuff...

Here is another answer: I had the same problem, but being so new to ruby/rails, I had no idea how to add the plan to Heroku db..As mentioned above by everyone :P After a lot of time clicking through stackoverflow, I finally figured it out.  So Simple!

For any other noobs like me, here is how you create a table in Heroku. (plans table in this situation)

```$ Heroku run rails console
&gt; Plan.create(name: 'basic', price: 0)
&gt; Plan.create(name: 'pro', price: 10)
```

Then check if it works:

```&gt; Plan.all
```

This should list your plans and their corresponding 'id'. 

Hope this helps!


Here is another answer: Check your heroku database. Most likely, your plans table is empty.

Comment for this answer: rake db:migrate only creates and updates your db schema. To load default data, you'll want to use seeds.rb and run rake db:seed.
Comment for this answer: Ok, this seems to be the case I used "heroku run rails console" and checked Plan.all came up empty don't really understand how this is though I migrated my database several times, using "heroku run rake db:migrate" I guess I am using the wrong command?
Comment for this answer: Thx for the help now atleast I know what my fault was :)

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 4, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2016:00:12/05/16', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<ruby-on-rails><ruby><git><heroku><activerecord>', 'Title': "Error in Ruby logs -> ActiveRecord::RecordNotFound (Couldn't find Plan with 'id'=1):", 'ViewCount': 909, 'id': 40971996, 'user_AboutMe': '', 'user_AccountId': 8700822.0, 'user_DisplayName': 'Pieter', 'user_Reputation': 101.0, 'user_Views': 23.0, 'user_id': 6510784.0}}