Ruby and Rails have stopped working completely on my machine - ruby-on-rails

I've been learning Ruby slowly over the last few weeks, and have been making methods using Sublime Text 2. I've been running these scripts in the terminal command line
ruby file_name.rb
These scripts have been running great in the terminal. I then wanted to start using Rails, so updated my current Rails version using RVM. However during install I kept getting error messages about needing Xcode or command line tools to be installed (both of which were installed). I quit out of that installation, and went back to testing out some ruby stuff.
However, now ruby and rails don't work at all. Even running
ruby -v
Nothing happens. I don't get a warning or an error, but my terminal simply switches the top bar from bash to env and back and forth constantly without anything happening. It just displays an empty line and not another command line. I then have to quit out of the script by pressing Control-C.
What happened? I tried reinstalling ruby but it's not working. I'm really confused...

Related

After installing tailwindcss for ruby should I skip the following suggestions/warnings:

I tried to complete the first suggestion by typing
ruby
rails bin/dev
but I was not able to get an output (The terminal showed no output )
then I realized my code was wrong so I tried once again and typed:
rails create bin/dev
But it showed me an error and said "rails aborted!
Don't know how to build task 'create' (See the list of available tasks with rails --tasks)
Did you mean? db:create"
Then I tried the other command by typing rails in front of it but that didn't work either.
So even though my app works should I bother to solve this warning or skip past it?
TLDR: You need to build your CSS output on every Tailwind style addition so execute bin/dev in a terminal to start your rails server AND watch for tailwind changes.
Hey! Your screenshot is saying that you have successfully installed Tailwind via the tailwind-rails gem.
The end of the message provides instructions on how to build your Tailwind CSS during local development so that Tailwind styles are output to the CSS and applied to your app on localhost:3000 immediately.
Option 1: (documented in the installation output) In your terminal, execute bin/dev to start your rails server AND watch for tailwind changes. This command uses a library called foreman to run two processes, reading from the Procfile.dev that was created in your project's root directory during tailwind installation.
Option 2: (documented in this section of the README) In your terminal, execute rails s in one terminal window and rails tailwindcss:watch in a different window (separate commands)
Option 1 is simpler and probably recommended.
(Based on your screenshot, you are not on a Mac and your exact command may differ, but these work for me on a macbookpro.)

ruby on rails console isn't working, I am getting"Switch to inspect mode" on windows

When I run my rails console it is saying "Switch to inspect mode" .I am working on windows . Kindly help !
This is likely due to the terminal you're using, not the console itself. (Which terminal are you using...?) Try running $ irb and seeing if you're getting the same issue.
I had the same issue a while back, and momentarily fixed it by changing the irb config output mode, but it still tended to break elsewhere. I recommend using ConEmu to permanently squash the annoyance.

GIT Bash MingW32 Rails Console - Text input fails after exit and restart console

I installed Rails and I am having issues with the Rails console in Git Bash (MINGW32).
The first time I launch the Rails console using rails c, I can input text and everything works as expected. However if I exit the rails console using Ctrl-C then start the Rails console again, the text input is wrong.
In the example, I started the Rails console, input "Zombie.first", got the expected response, exited the console, started it again, entered "Zombie.first" again, but the console actually executes "Zoiefr". Any text I enter after this will be similarly affected until restarting git bash.
I performed the RailsInstaller install on two different Windows machines with the same result.
Does anybody have suggestions for how to fix it, or for other Windows development environments to try?

Torquebox - project is not updated

I have installed:
Ubuntu 12.10
jruby 1.7.3
ruby 2
rails 3.2.13
RubyMine 5
DB2 C-Express
I have create a sample application and connected it correctly to the database - I know this because I have successfully executed the scaffold and migrate commands and check that the tables are created.
Then I have run the following commands in order to deploy my application with torquebox 2.0:
torquebox deploy
torquebox run
I have run these commands in my project folder and as a result on localhost:8080 I am seeing rails start page. I have the following issues:
Clicking on "About your application’s environment" tab I am getting the following error:
javax.servlet.ServletException: org.jruby.exceptions.RaiseException:
(NameError) cannot link Java class com.ibm.db2.jcc.DB2Driver, probable
missing dependency: Could not initialize class
com.ibm.db2.jcc.DB2Driver
org.torquebox.web.servlet.RackFilter.doRack(RackFilter.java:117)
org.torquebox.web.servlet.RackFilter.doFilter(RackFilter.java:101)
org.torquebox.web.servlet.RackFilter.doFilter(RackFilter.java:72)
org.torquebox.web.servlet.SendfileFilter.doFilter(SendfileFilter.java:49)
org.torquebox.web.servlet.SendfileFilter.doFilter(SendfileFilter.java:33)
I believe this is because the torque box is not able to find the driver. But why as it is vissible in my rails application and I successfully created/migrate tables from it using the terminal? Should I put the driver somewhere else,too?
Then I the torque box documentation is said:
Changes to your Rails application show up immediately in the browser,
as expected. When you're done, press CTRL+C in the terminal to stop
TorqueBox before continuing with the next steps.
But that's exactly what I have had to do in order to refresh the content of the page. I have changed my gem file and database.yml file but refreshing the page did not reflect this. After I have stop the server and start it again it shows something different.
Could you advise or tell me what I am doing wrong?
Without restarting the Torquebox server your can redeploy the knob with touch just run
touch $TORQUEBOX_HOME/jboss/standalone/deployments/your_apps-knob.yml.deployed
this way you don't have to restart whole JBOSS server.Deployment via descriptor
For production setups you can use Capistrano Torquebox Capistrano support

Inputting Terminal Commands When Running a Rails Server

I just started using Rails a few days ago, and I'm having trouble with terminal commands. The textbook I am reading keeps telling me to run Terminal commands while having a Rails server running. This doesn't seem possible because the terminal just keeps outputting information about the server instead of prompting new commands, i.e. rake test. Is there a command I need to input to force the terminal to prompt my commands once I start the rails server?
Usually you will just start a second Terminal window or tab and run the commands your book mentions in there. It will use the same database, but not the same process your server is running in.

Resources