When I'm trying to launch Rails console on netbeans 7.4 after I create project I get /home/mati/.rvm/rubies/ruby-2.1.0/bin/ruby: No such file or directory -- script/rails (LoadError) , but this file exists. I was looking here Rails on Netbeans: Uncaught exception: no such file to load -- script/server or script/console but it didn't really help. Is there something else I could try?
Create a symbolic link as below on terminal:
ln -s ./bin ./script
This is because in Rails 4 script directory has been moved to bin.
Related
I am starting to build Ruby on Rails project, but can't start the server, because sqlite3 is not installed
`require': cannot load such file -- sqlite3/sqlite3_native (LoadError).
I downloaded Precompiled Binaries for Windows archive from the sqlite site, where do I save the files now? What should I type in the terminal window?
To use sqlite3,
Unpack the precompiled Binaries for Windows in C:\WINDOWS\system32 folder.
Then on your cmd, do a "gem install sqlite3".
[That should fix it. To test:]
Create a rails app. "rails new test"
cd into the directory and "rails g scaffold post title:string body:text"
"rails db:migrate"
So the only way i got to install sqlite3 is by running RailsInstaller (http://railsinstaller.org/en). It installs the whole bundle of programs for Ruby on Rails app though.
I am a beginner trying to learn and do the Ruby on Rails tutorials (http://guides.rubyonrails.org/getting_started.html#installing-rails)
and for all the bin commands in the command window such as
$ bin/rails --version
or
$ bin/rails server
I am getting the error " 'bin' is not recognized as an internal or external command, operable program or batch file.'
I just installed the latest version of Ruby so I've tried running
rake rails:update:bin
and I also added the PATH variable C:\RailsInstaller\Ruby1.9.3\bin to my environment variables.
I'm still getting the same error.
Thank you in advance!
You are getting those errors because you are on Windows. In this case you have to pass the scripts under the bin folder directly to the Ruby interpreter like this:
ruby bin\rails server
If you have added the bin directory to your PATH variable, then you don't need to use it in the command. Just type $ rails --version, etc.
i have checked out a rails project into my svn repository.now i want to run that project on my local server.I entered rails server command to run it but i am getting an error that it cant find or read .yml file.what are the steps to be taken after one checks out some rails project in order to run it on local server.
cd into the directory containing the Gemfile and then do either rails s or bundle exec rails s. The error you are describing usually happens to me when I am not in the same dir as the Gemfile and Rails cannot find the database.yml file.
Example I have the file test.rb:
puts "test test test"
How do I run this file in the ruby console?
load 'test.rb'
Do you mean Rails console? (Same thing, but the question is tagged rails.)
load("test.rb")
should do the trick in irb.
On Mac you can run in three different ways from the terminal
Method 1
On Terminal irb (Interactive Ruby Shell) for line by line execution then quit command to be out of irb.
Method 2
As ruby is Interpreted language we can run by one command on terminal
Save the text editor code with .rb extension.
Change the directory in terminal by cd command (cd drag and drop the folder on terminal so that you can be directed to the directory).
ruby hello.rb
Method 3
ruby -v to know the version of ruby
ruby -e 'puts WVU' #line by line execution on terminal
Any ruby file can be run with just ruby <your_ruby_file.rb>, supposing that you are in the same directory as the ruby file; If not, just provide a path to the file:
ruby path/to/your_file.rb
I'm following Head First Ruby, and found out that the server file inside the script folder of my first project is missing. I followed this Ubuntu installation tutorial (sorry, Spanish link, still should be easy to follow the commands) and I guess some files/packages are missing. How I can get them?
antonio#antonio-desktop:~/Documents/tickets$ ruby script/server
ruby: No such file or directory -- script/server (LoadError)
antonio#antonio-desktop:~/Documents/tickets$ ls
app config.ru doc lib public README test vendor
config db Gemfile log Rakefile script tmp
antonio#antonio-desktop:~/Documents/tickets$ cd script
antonio#antonio-desktop:~/Documents/tickets/script$ ls
rails
If you're running Rails 3, it's now:
./script/rails server
All of the separate rails scripts in the scripts directory run through the single ./script/rails dispatcher now. This works for the console and other things you may be looking for as well (ie: ./script/rails console).