Rails form doesn't show up on heroku - ruby-on-rails

I have a Rails app on Heroku with a couple of forms on it. They show up fine locally, but on heroku, my form doesn't show up at all. I know my database is being accessed, because I have a greeting message with a user's name at the top of the page that's displayed fine.
Has anyone run into this issue and had any luck solving it?

Try to run your app locally on production environment and check is your form show up properly.

Related

How to make rails code reloaded each request

I'd like to play with rails code to understand it deeper and how everything works internally. And it could be very nice to change rails code and see the changes after reloading page (by default I need to restart server), what is the right way?
you shouldn't need to restart your server just refresh your page, except for adding migrations
also you can play with your rails app interactively using the rails console similar to irb
just type rails console or rails c into your app directory

Heroku rails blogger not processing login

So I push my rails_blogger app to Heroku and it goes fine, I run rake db:migrate and it goes fine, but then when I try to login using the email and password I made, it doesn't let me login and just renders the login page again.
When I run webrick on my computer everything works fine with login, but when I access the app from the heroku URL in my browser, it won't let me login!
Also, it won't even show the articles on the main page that anyone should see, logged in or not.
I've looked all over various google search results to find the answer to this to no avail.
Can someone help me understand the problem here?
GitHub repo: https://github.com/ck626/project_rails_blogger
Heroku page: scary-goblin-6551.herokuapp.com
The database that you use at heroku are different from your local database, so you need to create authors separately on heroku and at your local development server. In Rails you can configure your database (what database to use at production and at development) at config/database.yml.
Another thing to note heroku does not support sqlite, you need to use pg instead.

Rails Tutorial: Why can I sign up a new user without problems on the local server but not on Heroku?

I've completed the Rails Tutorial. I kept up with every detail until the end of chapter 8. The last four chapters I just copied and pasted without trying to understand much.
The Sample App works perfectly on a Cloud9 local web server, but not on Heroku. Specifically, When I want to sign up a new user, I get the message "We're sorry, but something went wrong."
Why can I sign up a new user without problems on the local server but not on Heroku? Is the functionality of the final sample app supposed to be exactly the same on both local and heroku?
You are getting a 500, look at the server logs for a clue. Probably need to run migrations.
Run your migrations:
heroku run rake:db migrate
You may need to restart heroku:
heroku restart
If it still doesn't work, try resetting your database. If you're using postgres, try:
heroku pg:reset DATABASE
I completed every step in the entire Rails Tutorial book, except one, which I thought was optional and wouldn't affect the result in production.
10.3 Email in Production shows you how to configure your application to send emails in production (for account activation in the book's sample application) using a Heroku add-on called Sendgrid.
You do have to give Heroku credit card information (though for the purposes of the book you don't have to actually make any purchase or subscription), and this is why I initially didn't implement this section of the book.
After following along and implementing section 10.3 my final application is fully functional in production.

Created an entry in rails console, but app has no idea it exists

I entered
SiteData.create(site_name: "My Site", url: "http://mysite.com")
in the console, SiteData being one of my models. Now I can write SiteData.find(1) and it will echo back the entry. Great!
I'm using the db table to store all the info about my site, such as the name, the url, the Facebook page, the Google Plus pages, etc. SO I need to access it on every page. Okay, I'll use before_filter in the application controller to make this work, right?
So I went into my app, and in the Application controller, I wrote
before_filter :add_site_data
def add_site_data
#site_data = SiteData.find(1)
end
And I get an error: "Couldn't find SiteData with id=1"
What now????
This might not be the best way to do this. I am brand new to rails. But I'm totally stuck and have no idea what's going on or why here. I installed Postgres locally today and set up the test and dev dbs, but it seems to be working fine since I can still create/read/update/destroy entries from the console.
Please help! I'm going nuts here. I am using Rails 4.0.
Resetting the server fixed it.
If you know you're making entries in your database that aren't reflected when you run your app, reset the server.

How to get this simple rails project to work on Heroku?

I followed this tutorial to make a simple website where you can enter blog entries. I was able to get it working with a postgresql database on my computer.
Then I pushed it to heroku. It was accepted and everything seemed fine.
When I tried to go to the page in my browser though, it didn't work right. You can see it here.
I even tried setting up a shared postgresql database on Heroku. Am I supposed to make some changes to database.yml to get it to work?
One thing I noticed though is that what I added in the shared postgresql database, the error messages seem to indicate that it does find a database, but doesn't find the table. Am I right? I tried to manually recreate the table using the heroku console, but wasn't able to.
What's going on here? How can I get this to work?
Have you tried heroku run rake db:migrate yet?
If that doesn't fix it what does heroku logs --tail tell you?

Resources