Missing template after copying rails project - ruby-on-rails

I copyed/pasted my rails project from work computer to personal computer on an Ubuntu Virtual Box, and I have an error while I try to access a page : "Missing Template".
Does anyone have an idea ?
(Sorry for my bad english)

In views folder, rails can't find index.html.erb file in /products folder.
Make sure you have index file there.
If it is not so paste your directory structure here
It should be here
/home/benjamin/workspace/Projet_ERP_Rails/app/views/products/index.html.erb
If it is not there, then create one.

Related

Ruby on rails : where and how should I define an output folder for generating files?

I'm learning Ruby, and i'm actually coding an app that would create playlists.
Once created, I would like to generate an output file (XSPF, which is a standard) in a custom directory (eg. my 'home' folder) and was wondering where I should define the output folder for those files.
I guess it is in the config folder, but where ?
Also, how will I call it in my script afterwards ?
Thanks !

Where is the .well-known folder on Heroku going to be, for a Rails 6 website?

I've created a website using Rails 6 on Heroku. I need to drop a file into /.well-known/ but I've no idea where that might be.
I created a folder with that name in the root of the project and checked it in to git, but it doesn't show up there.
It seems that I should use a route to do this, but I don't have a handle on the syntax to use. I basically need to expose a /.well-known/longhashedstring.txt to a 3rd party service for about a minute.
See above answer from Sharj. Put your .well-known folder in /public for Rails 6 and all is good.

Ruby Rails - Cant locate routes.rb to add page to site

I am currently working on a project where the majority if the site structure is already in place. I am trying to add a new section to it but am having difficulty getting links to work.
I replicated what another page had however in tutorials I am seeing reference to a routes.rb file which specifies how links work. The problem is i cannot locate the routes.rb file. Is there anything I am missing or is routes.rb specific to a certain version and I am using a different version. Any help would be much appreciated.
I think your routes file was deleted. You can check git status. You will be find deleted file there. Rollback that change or create new file routes.rb in config/ folder.
If the app is a standard Rails app, you should be able to find routes.rb in the app's config/ folder.
How about just using your editor to do a file search and locate the file?
For Sublime Text, cmd + p for MAC will suffice.

How to replace a Template using Deface

I'm new to rails and I've set up a standard spree e commerce solution. I now want to customize the default templates and styles. According to the spree documentation [1], the best way to do so is using Deface. Unfortunately, I can't figure out the location of the existing views/layouts.
For example, while the document suggests:
For example, to override the main layout, create the file YOUR_SITE_OR_EXTENSION/app/views/spree/layouts/spree_application.html.erb
my app/views folder doesn't contain a folder called spree
Can anybody tell me, how to change the view templates?
Thank you.
[1] https://guides.spreecommerce.com/developer/view.html
You have to actually create that directory and every directory along the way until you reach the file you wish to override. If you run these commands from your root directory you should be good to go.
mkdir app/views/spree
mkdir app/views/spree/layouts
touch app/views/spree/layouts/application.html.erb
Then copy the content from here: https://github.com/spree/spree/blob/master/frontend/app/views/spree/layouts/spree_application.html.erb into the file you've just created.
If you restart your web server you should be able to make changes to the local application.html.erb file and see them locally.
Any time you want to override a template completely, you can find the template you need to override on Github: https://github.com/spree/spree and recreate the necessary files/directories. Spree will look for templates in on localhost before the gem, so as long as you override the right template in the right directory, you can customize any view you like.
Alternatively, you can try running the rails generate spree:frontend:copy_views command to pull all the views you need from gems, and anything that is missing can be added manually, in strict accordance with the gems folder hierarchy. For example, in gems is parsl in the following spree_backend/views/spree/admin/users/_lifetime_stats.html.erb. To enter the desired code, I have to make a folder on the following path - the name of the project/app/views/spree/admin/users/_lifetime_stats.html.the erb and all the changes I will make here will fall into the main view code. This is an alternative to Deface::override

How to update asset_packager for heroku

I am trying to modify javascript files in a Ruby on Rails application in HEROKU. Every time I modified something, it did not have any effect on the application. Thanks to a member in this web site, I realized that my application is using asset packager. This asset packager creates a file called base_packaged.js that has all the javascript file compressed.
Because I am new with Heroku and using Windows I modify everything with a text editor, in this case I use notepad++. So when I change the file for example quote.js, nothing happens. I suppose The file quote.js is changed but the compressed base_packaged.js is not been updated. So when I push the file using GIT GUI to Heroku, only the file quote.js is updated but heroku does not recognized that change and does not modify the base_package.js.
How can I modify edit or update the base_package.js. Obviously file is very important I don't want to make a mess with my application.
Thank you.
Ok, so this is surely a suboptimal solution but I have had the same exact problem and this is what I have done. Go into any file such as your rake file in your public directory and just add something to a comment or add another comment.
Git will see this change and your other changes will get added along. I completely understand that this is a hack but It is super easy you works!

Resources