Ruby on Rails - Errno::EACCES in Posts#show - ruby-on-rails

I'm doing this ruby on rails tutorial - http://guides.rubyonrails.org/getting_started.html
After doing 6.4 part, I started getting this error if I try to do anything. For I get this error when trying to see a post:
Errno::EACCES in Posts#show
Showing /home/user/rails/blog/app/views/layouts/application.html.erb where line #5 raised:
<html>
<head>
<title>Blog</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
</head>
Permission denied - /home/user/rails/blog/tmp/cache/assets/development/sass/bd7e1cc0cf5d133ac313bf5ffa5e5d87b843522a/comments.css.scssc
(in /home/user/rails/blog/app/assets/stylesheets/comments.css.scss)
Rails.root: /home/user/rails/blog
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__1904510075995834678_70186546148480'
Request
Parameters:
{"id"=>"1"}
It shows that this line raised an error:
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
And the file that shows I was denied to access (comments.css.scss), is empty, with just three comment lines. What could be wrong here? I followed tutorial guidelines, don't know what I could have done differently.

If your OS is Windows you can run this in the Windows command prompt.
icacls C:\User\username\rails\blog /grant Everyone:F

sudo chmod -R 777 /home/user/rails/blog will solve your problem.
give it a try...

Related

what is causing Less::Error 'Unrecognised input'?

I'm following this answer about using yarn to set up semantic-ui with rails but get this vague error that says only Unrecognised input whenever I access localhost. The stack trace is short and the only clue it provides is to the stylesheet and javascript link tags in my application.html.erb head:
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
What does Unrecognised input mean, and what causes it?
who would win? many lines of code or one missing semicolon?
make sure you end your variable declarations with a semicolon.

JSON Parser Error Unexpected Token Error Rails

I recently cloned my Rails app, which was developed on Linux, to my Windows OS. There were a few errors, and I managed to fix most of them except this one. This error pops up when I try to access my page locally:
JSON::ParserError
419: unexpected token at ''
This is the code in question:
<head>
<title>DemoApp</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= javascript_include_tag "ckeditor/ckeditor.js" %>
<%= csrf_meta_tags %>
I researched and couldn't find a straightforward solution to this. I had previously changed my runtimes.rb to 'UTF-8' so that it will run in Windows.
Any help is much appreciated.
It could be because of a BOM or a tabulation space, it happens to me when I try to paste inside Vim.

How to remove Invalid CSS after "": expected "{", was ""

I restart my project after one month and get this error
Showing /home/abc/prij/app/views/layouts/application.html.erb where line #5 raised:
Invalid CSS after "...���������������": expected "{", was ""
ActionView::Template::Error (Invalid CSS after "...���������������": expected "{", was ""):
2: <html>
3: <head>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
6: <%= csrf_meta_tags %>
7: </head>
How I resolve this?
Something's very wrong with one of your asset files. Are you sure you're not including a non-css file in your application.css.scss?
I'd narrow it down by removing some of your requires from application.css.scss. Hopefully this will isolate the problematic code, but it's tough to say much without more information.

Bootstrap Gem Installation Issue

I have added the bootstrap-sass gem and have installed the bundle. I have gone to github and think I have followed the directions correctly to finish the install for ruby on rails. It doesn't appear to be making a difference however on my local site - no font/formatting changes have been made, even after the install.
I am using a PC, https://github.com/findingtheway/pin
Change your app/views/layouts/application.html.erb to this:
<head>
<title>Pin</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
Rails uses application by default you have default which is why bootstrap is not loading.

Errno::ENOENT No such file or directory Rails 4

Showing "/Users/Christian/Desktop/sample_app/app/views/layouts/application.html.erb" where line #5 raised:
No such file or directory - /Users/Christian/Desktop/vendor/assets
(in /Users/Christian/Desktop/sample_app/app/assets/stylesheets/custom.css.scss)
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>`
I was developing on linux ubuntu and it works fine there, I copied the folder to my mac and it no longer works. custom.css.scss is in the correct location
The problem is on line number 5 :
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>`
Change sass-rails version to 4.0.3 and leave the rest as it is. Remove Gemfile.lock when necessary, and then:
$ bundle update
$ bundle install
Finally, don't forget to restart your rails server!
In your Gemfile change the sass-rails version to 4.0.3. Get rid of a version number for sprockets. Delete the Gemfile.lock. Run the bundle install again

Resources