Rails + Google Polymer - ruby-on-rails

I am getting this error when I try to hit my homepage. Trying to integrate Polymer into my Rails app. Any suggestions?
gem 'polymer-rails', '~> 0.1.9'
gem 'polymer-core-rails'
gem 'polymer-paper-rails
ActionView::Template::Error (couldn't find file 'webcomponentsjs/webcomponents-lite' with type 'application/javascript'):
3: <head>
4: <title>Polymer Rails Example</title>
5: <%= stylesheet_link_tag 'application', media: 'all' %>
6: <%= javascript_include_tag 'application' %>
7: <%= html_import_tag 'application'%>
8: <%= csrf_meta_tags %>
9: </head>
app/assets/javascripts/application.js:13
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___3181512530753562001_70181169375440'

Related

ActionView::Template::Error (783: unexpected token at {I"session_id:ETI"%057313a4edd6443f451bb32837ad6368;')

I recently upgraded my Rails application from version 5.2 to 6.1, and I'm now seeing an error in application.html that I can't seem to resolve. The error message I'm seeing is:
ActionView::Template::Error (783: unexpected token at {I"session_id:ETI"%057313a4edd6443f451bb32837ad6368;')
I suspect that the problem I'm experiencing is related to the csrf_meta_tags not being compatible between Rails 5 and 6 versions. However, I'm not sure how to fix it. Does anyone have any ideas on how I can resolve this issue?
Any help would be greatly appreciated. Thank you!
Error output:
ActionView::Template::Error (783: unexpected token at {I"session_id:ETI"%057313a4edd6443f451bb32837ad6368;'):
5: <%= stylesheet_link_tag "application" %>
6: <%= javascript_include_tag *deferred_external_javascript_sources %>
7: <%= javascript_include_tag "application" %>
8: <%= csrf_meta_tags %>
9: </head>
10: <body>
11: <div class="header">
app/views/layouts/application.html.erb:8

Rails error after creates new page ActionView::Template::Error (The asset "application.css" is not present in the asset pipeline

I want to create a maintanance_mode page in my rails app. So I've created StaticPagesController with maintanance_mode method (it's empty) and views views/static_page/maintanance_mode.html.erb with routes below:
Rails.application.routes.draw do
root to: 'react#index',
get: '/maintanance_mode', to: 'static_pages#maintanance_mode'
scope 'api' do
use_doorkeeper do
skip_controllers :applications, :authorized_applications, :authorizations
end
end
I was trying to get into this page (simple Hello) but I've got an error
ActionView::Template::Error (The asset "application.css" is not present in the asset pipeline.):
8: <%= csrf_meta_tags %>
9: <%= csp_meta_tag %>
10:
11: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
12: <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
13: </head>
14:
The solution was quite simple, I have to add application.css with below code
application.css
/* ...
*= require_self
*= require_tree .
*/

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

Michael Hrtl's Ruby on Rails Tutorial ep 5. Changing the hash from :media to media: doesn't work

only on tutorial 5 and I am stumped.
This is similar to a previous post by user1420228, but the answer given didn't really resolve the problem.
In Michael Hartl's application_helper.rb file:
<!DOCTYPE html>
<html>
<head>
<title> <%=full_title(yield(:title)) %> </title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
However, he suggests changing the :media hash to the newer media:.
He makes the change and demonstrates the sample app working.
I made the same change and the sample app failed with the following error:
SyntaxError in Static_pages#home
Showing /Users/osmanahmed/Rails_Projects/sample_app/app/views/layouts/application.html.erb where line #5 raised:
/Users/osmanahmed/Rails_Projects/sample_app/app/views/layouts/application.html.erb:5: syntax error, unexpected tASSOC
...tag "application", media: => "all" );#output_buffer.safe_...
... ^
Extracted source (around line #5):
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>
Trace of template inclusion: app/views/layouts/application.html.erb
Rails.root: /Users/osmanahmed/Rails_Projects/sample_app
ruby -v gives me: ruby 1.9.3p392
rvm -v gives me 1.20.13
rails - v is 3.2.13
As a side issue, if I ignore the change to the new hash everything works fine, but if I progress further in the tutorial I find that my static home page contents load twice. So I suspect I should try and fix this issue before I try and debug the new "page loading twice error"
I am guessing this is a configuration issue, either I have loaded the incorrect gemfile or something.
Can anyone point me in the right direction please?
Oz
Looks like you're doing media: => "all". It should be media: "all". No hash-rocket.

Twitter Bootstrap Error Using Less

Following this video
After generating the app, scaffolding, updating gemfile, running bundle install, and running rails server, getting ERROR.
Am using the gem
'twitter-bootstrap-rails'
, is there a reason why it is having an issue with "less?" =>
ActionView::Template::Error (cannot load such file -- less (in
/Users/ryanmindigo/store/app/assets/stylesheets/bootstrap_and_overrides.css.less)):
2: <html>
3: <head>
4: <title>Store</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__2789023687141131830_70195710799000'
app/controllers/products_controller.rb:7:in `index'
Deleting the bootstrap_and_overrides.css.less file, may not be necessary with updated gem. Please comment if a new error appears so we could see some more.

Resources