Problem:
The rails UI interface for generating scripts bundle in Textmate is not working.
Description:
In a rails document:"Bundles"> "Ruby on Rails"> "Call Generate Script" and choose "Controller" then type"index" > "index" and submit.A window appears telling me: "Done Generating controller".Yet when I browse through my directories nothing new has been created.
Screenshot:
I take a screenshot of what happens during the generation process:
http://img152.imageshack.us/i/capturedcran20110201003.png/
Versions:
ruby -v: ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
rails -v: Rails 3.0.3
I tried the same with an RVM environment by following this tutorial:
(http://rvm.beginrescueend.com/integration/textmate/)
The result is the same.
Regards,
Guillaume.
You have to slightly modifiy the bundle to make it work with the Rails 3 generate scripts. Have a look at my modifications on GitHub:
https://github.com/dhoelzgen/ruby-on-rails-tmbundle
The error there says that there's "No such file or directory -- script/generate". This leads me to beleive that you're using Rails 3, where the command is now rails generate or rails g for short. Upgrade your Ruby on Rails TextMate bundle (follow the instructions on the GitHub Page) or alternatively run rails g controller [name] from the command line.
Related
I study Rails with the book "Head First Rails"
steps are:
to create my app with the command "rails new tickets"
run server with "ruby script/server"
"ruby script/generate scaffold ..."
But there is no script folder in the project and I get an error "ruby: No such file or directory -- script/generate (LoadError)"
I've found that I need to use "ruby s" to start the server.
But how can I run script/generate?
Is it a new style of generating folders in the rails project and there is no more script folder? Or did I smth wrong?
I have ruby version 2.4.4 and rails 5.2.1
nowadays it is used rails instead of ruby script/, so try rails server or rails generate scaffold
I entered a existing ruby application, and type:
$ rails s
wanted to start rails server here.
but it said:
Your Ruby version is 1.8.7, but your Gemfile specified 1.9.3
Actually, I had a 1.8.7, but I deleted it. And if I do:
$ ruby -v
it said:
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-darwin11.4.2]
So I don't know how can I fix it. Can you give me a help?
If you are using rvm, run this:
$ rvm use 1.9.3
try using bundler
bundle exec rails s
I had similar problem:
$ bundle install
Your Ruby version is 2.1.0, but your Gemfile specified 1.9.3
but:
$ ruby -v
1.9.3-p484
$ which ruby
/home/malo/.rvm/rubies/ruby-1.9.3-p484/bin/ruby
I've found five answers: 1, 2, 3, 4, 5. Also it was open issue on github. However, I've resolved the problem as follows:
Got path to my bundler:
$ which bundle
/home/malo/.rvm/gems/ruby-1.9.3-p484#global/bin/bundle
Opened it to edit (or just cat it), and saw that it has invalid link to ruby in the first line:
$ cat $(which bundler)|head -n 1
#!/home/malo/.rvm/rubies/ruby-2.1.0/bin/ruby
Then I get the path to current valid ruby, and just replaced that invalid with it:
$ which ruby
/home/malo/.rvm/rubies/ruby-1.9.3-p484/bin/ruby
Of course you can also try replace it with the common form:
#!/usr/bin/env ruby
This should pick up the currently used ruby version.
I found out the reason I was getting this error was that I was shelling out to a Heroku command line program inside of my configuration files and Heroku Toolbelt comes with it's own version of Ruby.
The two solutions to that problem are to either not shell out to Heroku or use a Bundler.with_clean_env block instead of the backticks to shell out the heroku command.
Please try this:
1. Open your gemfile
2. Specify rails version
3. Run bundle update
4. Run rails server - rails s
Every now and then this happens with me. However I often don't like switching ruby versions here and there. So instead what I do is I just go to the Gemfile and switch the ruby version to the one that I am using. Doing this allows me to fire up my server and keep working on things.
so for instance, right now for the app i'm working on, my Gemfile is at
ruby ENV["CUSTOM_RUBY_VERSION"] || "2.1.6"
and I would just alter it to
ruby ENV["CUSTOM_RUBY_VERSION"] || "1.9.3"
I have installed ruby193 and I've installed rails via the command prompt. However, whenever I try the command:
ruby script/server
I get this error:
ruby: No such file or directory -- script/server (LoadError)
I checked my script folder and all it has is a file called rails.
I'm very new to Ruby on Rails and I'm not entirely sure if I've installed everything correctly. Is there an easy way to check what I have installed?
To clarify on the existing answers, ruby script/server is no longer the proper way to start a server in Rails. In Rails 3, we use rails server, which can be shortened to rails s. See the Rails Guides for a more extensive rundown of the Rails 3 command line interface.
Try running rails server or rails s.
If you have Ruby & rails installed properly, then ruby -v would result in the version that you have installed and likewise rails -v would give the rails version installed.
To run a rails server try running rails server or rails s
I have a question regarding my Ruby on Rails installation.
I am using ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
and rails -v
Rails 3.1.3
When I create a new app with
rails new first_app
I get 2 new application directories (first_app & new) which is kind of strange to me because I thought I should only get one 'first_app'. This seems to be behaviour of Rails 2.x
Also when I type command
bundle install
output is
Could not locate Gemfile
And its true - there is none in the application directory
app config db doc lib log public Rakefile README script test tmp vendor
Any idea why this is going to happen?
I am having trouble using script/generate. I am following the tree based navigation tutorial, which says to use script/plugin install git://github.com/rails/acts_as_tree.git or script/generate nifty_layout.
I keep getting:
No such file or directory -- script/plugin
I've tried these variations:
script/generate nifty_layout
rails generate nifty_layout
ruby script/generate nifty_layout
ruby generate nifty_layout
and they all tell me:
-bash: script/generate: No such file or directory
Am I missing something? Total ruby nuby here and I just can't seem to find an answer.
edit: rails 3 on Mac OS X 10.6
Rails 3 is your problem (or rather the cause of). Since rails 3 all of the "script/whatever" commands have been replaced with "rails whatever".
So now you want "rails generate ..." or "rails server" instead.
Be sure to watch version numbers or post dates when looking at tutorials :)
linkage:
Missing script/generate in Rails 3
There is a LOT of out-of-date information on the interwebs for Rails now as a result of it evolving quickly and being so popular. I use the Ruby on Rails Guides as my first stop for information as those pages seem to be the most current.
The rails generate info seems current.
you may try a couple things, first, make sure since you are using rails 3 that you have run 'bundle install'. depending on how you installed rails and which version of bundler you are using, it may not be finding your rails binary to execute the rails generate .. so you may try prefixing it with bundle exec rails g but that is deprecated and you should get a warning if you call it. Also, make sure you are following ryan's instructions for rails 3 (and run bundle install once you add to the gemfile) on his library: https://github.com/ryanb/nifty-generators
As a shortcut to rails server, you can use 'rails s'. Similarly for the console, 'rails c'.