I have been following Michael Hartl's ruby on rails screencasts, however I have the older Rails 3 ones and not the videos for Rails 4. So far it hasn't been much of an issue, but I would like to have my app deploying to heroku and following his instructions leads me to a 404 not found page for the home screen.
When navigating around (i.e. manually entering in pages/home) it brings me to the static HTML pages, but doesn't load any CSS etc.
I looked through Heroku's site and they mentioned to install rails_serve_static_assets. I did
gem install rails_serve_static_assets
bundle install
as well as added rails_serve_static_assets to my Gemfile like this:
group :production do
gem 'thin'
gem 'pg'
gem 'rails_serve_static_assets'
end
Everything pushes just fine, it says it's deployed, but when I refresh the page it still gives me a 404 not found page.
What do I need to do to have it deploy correctly?
Thanks in advance!
Related
In my project with content_tag_for I had an error:
The content_tag_for method has been removed from Rails. To continue
using it, add the record_tag_helper gem to your Gemfile: gem
'record_tag_helper', '~> 1.0'
So, I added this gem to my Gemfile. $ bundle install returns:
Using record_tag_helper 1.0.0
I have restarted server, cleared Rails cache and so on, but I still have the same error, that content_tag_for method has been removed from Rails. I just have no more ideas why it doesn't work.
Share your ideas, please.
Looking at the Github page, the gem has not been updated in 2 years. Also the last update contains the message 'Prep for Rails 5'. I'm assuming that this gem isn't compatible with Rails 5.
I have added "require 'record_tag_helper'" to my application.rb file and now it works.
I installed gem better_errors version 2.1.1 for my ruby on rails application. However, I still get the same old debug page. I have also installed the gem binding_of_caller. I even installed the three gems which as shown as runtime dependencies for better_errors, namely erubis, coderay and rack(see the gem page here). All this to no avail.
I have also tried other solutions, one is this. All this to no avail.
I am using Ubuntu 16.04, rails 5.0.0.1 and ruby 2.3.1p112.
Make sure you are not testing with just a routing error / 404 exception, as that will no longer end up triggering better_errors.
Best way to confirm whether it's working or not would be to put some undefined variable in a controller action and then hitting that URL.
You installed the gem in development?
'group :development do
gem "better_errors"
end'
I just added better_errors to my Rails 5 app and its working fine.
I am receiving the following error message when attempting to authenticate with Facebook in a rails app using MongoMapper:
It appears that MongoMapper is not being loaded properly, but I am not sure why. In my Gemfile I include gem 'mongo_mapper, gem 'bson_ext', and gem 'omniauth-facebook', '~> 1.4.1'. I also followed the setup instructions here: http://mongomapper.com/documentation/getting-started/rails.html to completion. I am able to run the $ mmconsole, as well as connect to the mongod using the $ mongo. Is there another configuration step that I missing to ensure that mongo_mapper can be loaded properly? Thanks in advance for any assistance, I am new to MongoDB in general.
EDIT:
Here is what my SessionsController looks like, where the LoadError originates:
I have just installed rails 4.2 . I have found this tutorial for making a quick blog: https://www.reinteractive.net/posts/32-ruby-on-rails-3-2-blog-in-15-minutes-step-by-step . However, it uses rails 3.2 . I have done everything that it says up to rake db:migrate and yet, when I run the server, I just get an error page. What has changed since 3.2? what do I now have to do to do the same thing?
error:
'ExecJS::ProgramError in Posts#index'
TypeError: Object doesn't support this property or method
(in C:/Ruby193/lib/ruby/gems/1.9.1/gems/turbolinks-2.5.3/lib/assets/javascripts/turbolinks.js.coffee)
EDIT:
On a side note, I can't even follow the official ruby on rails tutorial because when I run the server, after changing the root to root 'welcome#index' , I just get a page not found error.
Are there any tutorials for rails 4.2?
I had exactly the same ExecJS::ProgramError on Windows. The only solution that really helped was provided by KeithP here: Rails-4, ExecJS::ProgramError in Pages#welcome, i.e.,
Rollback to gem 'coffee-script-source', '1.8.0'.
There's some info here: ExecJS::RuntimeError in Users#index (RoR)
What I found when I looked into this problem was that in CoffeeScript there's a checkin here that I think broke things for Windows (under certain versions of the cscript runtime): https://github.com/jashkenas/coffeescript/blob/28c07d30cbd2add7ee762c7d532b2c9c972e441a/lib/coffee-script/parser.js
On line 563 it's doing an Object create(lexer) which fails with the error ActionView::Template::Error (TypeError: Object doesn't support this property or method.
Rolling back to CoffeeScript 1.8.0 (before this change) works around this problem. As others have stated in this answer and elsewhere, using a different runtime will workaround this problem too.
To roll back to CoffeeScript 1.8.0 add this to your gemfile:
gem 'coffee-script-source', '1.8.0'
And run these commands:
gem update 'coffee-script-source'
bundle update 'coffee-script-source'
Restart your server and it should be working.
This should solve your problem:
Add gem 'therubyracer', '~> 0.12.1' into your gemfile (or uncomment it - should be already there...)
Then run bundle install
Hope this helps.
I'm at ch. 7 on the Hartl RoR tutorial.
When I try to load the url /users/1 it's supposed to give me the Example User (which I successfully updated in console.
Instead, I get this error screen:
LoadError in UsersController#show
cannot load such file -- bcrypt
def require(file)
result = false
load_dependency(file) { result = super }
result
end
end
Rails.root: /home/ubuntu/workspace
Not sure what this means exactly. I've gone through all my code so far from this chapter and last, and can't seem to find what I'm missing.
Any help is appreciated, and hopefully for any other newbie using this tutorial, as well.
Thanks,
Tim
See if you have this in your Gemfile:
gem 'bcrypt-ruby'
If not, add it. Then run bundle install to install it and don't forget to restart the server.
Tutorial says to install it gem 'bcrypt', '3.1.7' in chapter 6, but it doesn't say anything about restart the server. That's what you normally do after adding a gem.
Listing 6.33: Adding bcrypt-ruby to the Gemfile.
https://www.railstutorial.org/book/modeling_users