Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue(s) Deploying Rails app (SQLite3) to Heroku (PostgreSQL)
    primarykey
    data
    text
    <p>I see numerous posts regarding issues with deploying to Heroku, but I haven't been able to find the solution for my case. Any input would be much appreciated.</p> <p>I have a blogging application that runs fine locally. However, I am returning "I'm sorry, but something went wrong" when I deploy to Heroku. </p> <p>The gems I have are:</p> <pre><code>group :development do gem 'sqlite3', '1.3.5' end group :production do gem 'pg', '0.12.2' end </code></pre> <p>The steps I've taken are:</p> <pre><code>git add. git commit -am "latest update" git push git push heroku rake db:migrate heroku run rake db:migrate </code></pre> <p>My SQLite3 database is migrating fine, as I can find my latest blog entry (Blog.find(21)) through rails console. However, the data does not seem to be migrating to the Heroku database, as the Heroku console returns </p> <pre><code>"ActiveRecord::RecordNotFound: Couldn't find Blog with id=21." </code></pre> <p>Additionally, "heroku logs" finds:</p> <pre><code>Completed 500 Internal Server Error in 50ms NoMethod Error (undefined method 'blogs' for nil:NilClass): app/controllers/static_pages_controller.rb:8:in 'home' </code></pre> <p>Does this mean there could be an issue in my static_pages_controller, or is it just returning an error because the database is not migrating correctly?</p> <p>Below is my static_pages controller, which works fine on my local server.</p> <pre><code>class StaticPagesController &lt; ApplicationController def home if signed_in? @blog = current_editor.blogs.build end @editor = Editor.first @blogs = @editor.blogs.paginate(page: params[:page]) end end </code></pre> <p>Note: I am using Editor.first above because I (ie. editor_id: 1) will be the only editor of my blog. I just created an Editor model to store the password_digest.</p> <p>So, why isn't my application deploying on Heroku? </p> <p>Any feedback would be appreciated. Also, please let me know if you need to see additional files, and I will attach. </p> <p>Thanks so much!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload