rails view not updating - ruby-on-rails

I have started with my first rails project using Redmine. I have started to dig into the code to get a better idea and having a hard time understanding the erb files. When I go to make a simple change to the welcome.html.erb file, I make the change and check in the browser and there is no change. Once I save a file is there something that I need to run before the view will be updated? I did not think so, but that is why I am here asking because the view will not update the page when I save the file.
Thank you in advance for any help.
UPDATE: After I update the .html.erb file and open it up again in vim, my changes are still there. Only problem is that the page does not reflect what the change has been made to and when I view source it is not there either?????

It looks as though my cloud server is slow to update the pages so I need to check and see why this is. There is no problem with the pages when working locally and the page was updated in the source the next morning.

Using an IDE is not a good idea when you're learning Rails.
Try opening a console and cd into your application directory. Then run rails s and you should see your application running on a browser when you point to localhost:3000
You can leave the server running and modify your view file with any text editor. Changes should reflect automatically without even need to restart the server.
HTH!

Related

Microsoft.Data.SqlClient.SqlException: 'Failed to generate SSPI context.' but it works sometimes

So as mentioned, when I first start my computer and open up my VS and project. I then click the start of the project and it works just fine. If I add an element to an HTML file I can sometimes just hot reload and it works. If I add something as simple as a console.writeline and save then restart I would get this, or I need to restart this if I add more than one thing to an HTML file and I get this issue. I shut down VS and then sometimes I need to restart my computer and it works just fine. Why does this happen.
I don't know what the real solution is but what I did to fix this was deleted my database and migrations. I added a new migration and update-database and it worked. I was hoping there was a better solution before I did this but I could not find the answer.

Grails - Won't open localhost when adding data to bootstrap.groovy

I am trying to learn Grails and following along the guide on grails.org http://guides.grails.org/creating-your-first-grails-app/guide/index.html which to some extend works fine. My issue is, that I follow the guide to the dot, and when I come to part 4.4 about bootstrapping data. I fill in the code in the BootStrap.groovy file in the init folder.
When I then proceed to run my app and try to connec to the url localhost:8080 the site simply will not load. I can acces the dbconsole and see that the data is bootstrapped, so I guess the app is working to some extend. But the site wont load.
When I remove 2 of the Vehicles, the site loads fine. I have tried using grails-clean, and kill all processes on the port 8080, stille nothing helps.
Please help me with this, as I am stuck!
In your save method call, add failOnError: true. It's likely that something is failing when you try to save it. Also keep an eye on your console for error messages.
If that doesn't help, post some exact code.

Correct file in production mode Ruby on rails

In my web site, i found a mistake inside a text on my html (langage => language)
I change directly here /app/views/ with vi text editor but when I reload my page (after navigator history cleanning). The mistake is still here
There is a kind of step to take in account the modification?
Thanks in advance
In Production you normally have to restart the server for changes to take place

How to change code on live Ruby On Rails

I am new to Ruby on Rails.
I have a site deployed on server and I'm accessing it with putty with hostIP and an RSA key.
How can I update the code on the deployed site? If the code is modified, do we have to rebuild (or run) the code?
Just edit the code using editor (vim, nano, or whatever), then restart your web server. But that's not the right way to do it. You should edit it in your local machine, and use a deployment tool like Capistrano. See below.
https://www.digitalocean.com/community/tutorials/how-to-automate-ruby-on-rails-application-deployments-using-capistrano
Modify the code with your favourite editor(vim/emacs/Sublime Text...) or IDE like Rubymine, save the change,
Refresh your webpage, your modification should take effect.

localhost:3000 won't update after saving changes in sublime

I'm new to programming and trying to make changes to a Rails app. I downloaded a forked repo from Github and got it up and running on my local computer after running rake db:migrate (originally got error messages).
I've since made changes to a few HTML files (minor - changed text of a few sentences) in Sublime and saved, but they aren't reflected in browser.
I refreshed the browser and tried restarting the server. I must be missing steps. Any help appreciated, thank you.
There are a few things that could be happening. Most likely, you are getting some browser cache( but you could be getting a network, web server cache as well)
Try reloading the page with ctrl + r ( or cmd + r if you don't like real nix)
Next you could try loading in an incognito window to see if it's a session level issue.
Next you can try restarting your server. In general in development environment there shouldn't a cache set up but maybe you are hitting an issue there.
In my dev config, I have all the caching off. In my dev browser I have all the dns/browser caches disabled.
At the end of the day, you could be modifying the wrong file. Try ack'ing or grepping to see if there are other occurrences of that text in other files. Often there will be multiple header partials or multiple layouts that are similar but not really.

Resources