ruby on rails tutorial, creating pages - ruby-on-rails

Folks,
Trying to learn ruby on rails... following the tutorial, and after doing the foll
rails generate controller Pages home contact
Following shows up in the log/production
Started GET "/pages/home" for 24.18.129.38 at 2013-01-20 10:32:17 +0000
Processing by PagesController#home as HTML
Rendered pages/home.html.erb within layouts/application (0.0ms)
Completed 500 Internal Server Error in 2ms
ActionView::Template::Error (application.css isn't precompiled):
2: <html>
3: <head>
4: <title>FirstApp</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___2607526346352188026_23275800'
Started GET "/pages/contact" for 24.18.129.38 at 2013-01-20 10:32:21 +0000
Processing by PagesController#contact as HTML
Rendered pages/contact.html.erb within layouts/application (0.3ms)
Completed 500 Internal Server Error in 3ms
ActionView::Template::Error (application.css isn't precompiled):
2: <html>
3: <head>
4: <title>FirstApp</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___2607526346352188026_23275800'

# config/environments/production.rb
...
config.assets.compile = true
...

Related

500 Internal Server Error with Rails 6 and React as front-end

I'm having this error
Started GET "/" for 127.0.0.1 at 2020-03-30 16:20:14 +0800
Processing by ProductsController#index as HTML
Rendering products/index.html.erb within layouts/application
Rendered products/index.html.erb within layouts/application (Duration: 0.3ms | Allocations: 70)
Completed 500 Internal Server Error in 45ms (ActiveRecord: 0.0ms | Allocations: 18735)
I'm using Rails 6 and React as the front-end. I did include a dummy index.html.erb to Rails view.
application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>AnimeStore</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= javascript_pack_tag 'application'%>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<%= javascript_pack_tag 'index' %>
<%= stylesheet_pack_tag 'index',media: 'all' %>
</head>
<body> <%= yield %> </body>
</html>
I had a similar issue with Rails 6 and devise. This comment in Github was useful: https://github.com/rails/rails/pull/38820#issuecomment-604058068

Ruby on Rails v5.1.1 Home Page

I'm starting to develop in RoR and I have found the following problem:
Message
The command prompt:
Started GET "/pages/inicio" for 127.0.0.1 at 2017-06-22 22:43:24 -0300
Processing by PagesController#inicio as HTML
Rendering pages/inicio.html.erb within layouts/application
Rendered pages/inicio.html.erb within layouts/application (0.5ms)
Completed 500 Internal Server Error in 844ms
ActionView::Template::Error ():
4: <title>Pmo</title>
5: <%= csrf_meta_tags %>
6:
7: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8: <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9: </head>
10:
(execjs):1
app/views/layouts/application.html.erb:7:in app_views_layouts_application_html_erb__652431424_78968160'
The application.html.erb file is this.
The controller was generated in the following way:
rails g controller Pages inicio
Environment:
Windows 10
Nodejs v8.1.2
Rails v5.1.1
Ruby v2.3.3
Thanks in advance.
per your error message, it looks like stylesheet problem (line 7) from your application layout, please check your stylesheets /app/assets/stylesheets/ make user your settings in application.css is correct

Rails 5: could not convert "application/vnd.ms-fontobject" to nil Error

I have problem when applying vendors assets on rails 5.0.0.1 on ruby 2.3.1.
I am getting this errors:
ActionView::Template::Error (could not convert "application/vnd.ms-fontobject" to nil):
4: <title>Inventory</title>
5: <%= csrf_meta_tags %>
6:
7: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8: <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9:
10: </head>
app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__1205425238055745241_70060113419160'
Rendering /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout
Rendering /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.1ms)
Rendering /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.3ms)
Rendering /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.7ms)
Rendered /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (15.9ms)
I have add folder fonts on assets folder and add that to application.rb
I have searched on google with no luck.
What I did wrong, please?

Why rails isn't displaying a web page

Each time I launch a rails application, the server displays an error message. For instance (this is from the command line):
Started GET "/" for 127.0.0.1 at 2016-01-10 00:12:31 -0600
Processing by WelcomeController#index as HTML
Rendered welcome/index.html.erb within layouts/application (3.0ms)
Completed 500 Internal Server Error in 2054ms
ActionView::Template::Error (TypeError: Object doesn't support this property or method
(in c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/turbolinks-2.5.3/lib/assets/javascripts/turbolinks.js.coffee)):
3: <head>
4: <title>AlphaBlog</title>
5: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6: <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7: <%= csrf_meta_tags %>
8: </head>
9: <body>
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___602047428_59662224'
Rendered c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.0ms)
Rendered c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.0ms)
Rendered c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (64.8ms)
How do I fix this issue?
The first way to solve. Add to file application.js this line:
//= require turbolinks
The second method of solving. In Gemfile set version 1.8.0 for gem 'coffee-script-source' :
gem 'coffee-script-source', '1.8.0'
Try removing the javascript_include_tag (line indicated as broken) and see if the page loads. If the page does load, then it maybe something wrong with the assets files regarding javascript.

unable to import css in embedded ruby

hie
I tried to include #import "bootstrap"; in a file in stylesheets with name custom.css.scss
now on running the app i get the error as:
Started GET "/static_pages/about" for 127.0.0.1 at 2012-07-24 13:23:20 -0700
Processing by StaticPagesController#about as HTML
Rendered static_pages/about.html.erb within layouts/application (0.0ms)
Completed 500 Internal Server Error in 44ms
ActionView::Template::Error (different prefix: "C:/" and "D:/Rails/sample_app/ap
p/assets/stylesheets"
(in D:/Rails/sample_app/app/assets/stylesheets/custom.css.scss)):
2: <html>
3: <head>
4: <title><%= full_title(yield(:title)) %></title>
5: <%= stylesheet_link_tag "application", media: "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_ht
ml_erb___106293522_33950052'
Rendered C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6
/lib/action_dispatch/middleware/templates/rescues/_trace.erb (4.0ms)
Please advise how to fix it.
whatever you mean by the stuff that you are writing in your title, but i think that this problem is with your WIN setup: https://github.com/rails/rails/issues/660
I moved my application to the C:\ drive, where Rails is installed, to fix the issue.

Resources