How to import RoR project to Netbeans - ruby-on-rails

I have very simple (in fact empty ) project which i have created by rails new MyProject command from command-line. So, i want to import it to NetBeans IDE. I click "new project" -> "RoR" -> "from existing source", select Ruby 1.9.2 (instead of embedded JRuby) in the wizard form. After that i have got errors [see the picture below]:
So.. i click OK. And then try to run the RoR application from NetBeans clicking on the run-button and i got the following error in the log-panel:
/home/ses/.rvm/rubies/ruby-1.9.2-p136/bin/ruby: No such file or directory -- script/server (LoadError)
So how to handle these two problems?
p.s. my application is working when i launch it from the console.
i use ruby-1.9.2 and RoR 3.0 and Netbeans 6.9.1 and Ubuntu 10.10
and, replying the comment to my question. yes, i performed following commands:
bundle install
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.24)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.15)
Using actionmailer (3.0.3)
Using arel (2.0.7)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bundler (1.0.10)
Using mysql2 (0.2.6)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
bundle pack
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.24)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.15)
Using actionmailer (3.0.3)
Using arel (2.0.7)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bundler (1.0.10)
Using mysql2 (0.2.6)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Updating .gem files in vendor/cache
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating .gem files in vendor/cache
and following this page http://wiki.netbeans.org/FaqRubyRakeFetchingFailed
i did rake -D

this is what I did to get it working (had same problem):
New project > with existing sources
Tools > Ruby Platforms > select Ruby 1.9.2-p136 > Gem Manager > New Gems > rails > install
restart netbeans
open project (if it's not already opened) and right click > bundler > install
run
first of all, what you should't do is expect the debugger to work. because it's not going to work on netbeans, not on rails 3 (there are some hacks but they have problems).
secondly, Ruby on Rails Support Discontinued in NetBeans IDE. I loved the way Netbeans worked with rails 2.x, but I migrated to RubyMine because of it's support for Rails 3
hope this helps

Related

Could not find RubyGem railties (>= 0) (Gem::LoadError) with the RailsInstaller

In Ruby on Rails, I am trying to install it on my Windows machine following the step-by-step instructions indicated in http://railsinstaller.org/windows
On step 7, it says we should type in this command:
$ rails g controller welcome index
And so I do:
PS C:\Sites\railsinstaller_demo> rails g controller welcome index
And I get this error:
C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:926:in
`report_activate_error': Could not find RubyGem railties (>= 0) (Gem::LoadError)
from C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:244:in
`activate_dep'
from C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:236:in `activate'
from C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:1307:in `gem'
from C:/RailsInstaller/Ruby1.9.3/bin/rails:18:in `<main>'
I have googled this error and read that the solution was to install de DevKit and so I did, but the problem remains.
What causes these errors?
Edit:
This is what appears when I run gem list:
PS C:\Sites\railsinstaller_demo> gem list
*** LOCAL GEMS ***
actionmailer (3.2.9)
actionpack (3.2.9)
activemodel (3.2.9)
activerecord (3.2.9)
activeresource (3.2.9)
activesupport (3.2.9)
arel (3.0.2)
builder (3.0.4)
erubis (2.7.0)
foreman (0.60.2)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
mail (2.4.4)
mime-types (1.19)
minitest (1.6.0)
multi_json (1.5.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.2)
rake (0.8.7)
rdoc (2.5.8)
rest-client (1.6.7)
sequel (3.20.0)
sinatra (1.0)
sprockets (2.2.2)
taps (0.3.24)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
tzinfo (0.3.35)
As suggested by #EricLeschinski I tried tu run "gem install rails" but this error appeared:
PS C:\Sites\railsinstaller_demo> gem install rails
ERROR: Error installing rails:
The 'json' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
Final edit:
In the end, I don't how bad I messed up my initial installation, but I found this Youtube video http://www.youtube.com/watch?v=WUdDdiu8kBs which turned out to be the clearest way to install everything that I needed and had no problem at all following her instructions.
Could not find RubyGem railties
This error is due to the difference between the rails version you are using and the one defined in the Gemfile.
Try rails -v to check the rails version.
Reference : https://www.railstutorial.org/book/toy_app

Why does bundler keep installing gems I already have?

I have updated my system to Mountain Lion, built a new version of Ruby and, as far as I know, reinstalled all my old gems. However, whenever I cd into an old app and run the bundle command it takes an age because it is re-installing gems I know that I have on my system:
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.0.4)
Installing activesupport (3.2.1)
Using builder (3.0.0)
Installing activemodel (3.2.1)
Using erubis (2.7.0)
Installing journey (1.0.1)
Using rack (1.4.1)
Using rack-cache (1.1)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Installing sprockets (2.1.2)
Installing actionpack (3.2.1)
Using mime-types (1.17.2)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Installing mail (2.4.1)
Installing actionmailer (3.2.1)
Installing arel (3.0.0)
Using tzinfo (0.3.31)
Any thoughts, suggestions or ideas of what to look for would be really appreciated.
My first answer, but I would suggest using RVM to manage ruby versions and gemsets.
Check out RVM
After that, just create a .rvmrc file that you can find examples online. The power of the .rvmrc is that it runs whenever you "cd" into an app with that file present. So it will set your RVM with the appropriate Ruby Version and the appropriate Gemset (with all your gems) and never have to worry about versions and gems being conflicted or overlapped or not there etc...

Rails 3 rake error You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2

When I run rake db:migrate in my console:
rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. C
onsider using bundle exec.
(See full trace by running task with --trace)
C:\Rails\myapp>bundle install
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using erubis (2.6.6)
Using rack (1.2.4)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.30)
Using actionpack (3.0.9)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.2.19)
Using actionmailer (3.0.9)
Using arel (2.0.10)
Using activerecord (3.0.9)
Using activeresource (3.0.9)
Using addressable (2.2.6)
Using bundler (1.0.18)
Using multipart-post (1.1.4)
Using faraday (0.7.6)
Using friendly_id (4.0.0)
Using hashie (1.2.0)
Using json (1.6.1)
Using multi_json (1.0.4)
Using mysql (2.8.1)
Using oauth2 (0.5.2)
Using omniauth (1.0.2)
Using omniauth-oauth2 (1.0.0)
Using omniauth-facebook (1.2.0)
Using rdoc (3.10)
Using thor (0.14.6)
Using railties (3.0.9)
Using rails (3.0.9)
Using rest-client (1.6.7)
Using sequel (3.20.0)
Using simple_form (1.5.2)
Using sinatra (1.0)
Using sqlite3 (1.3.4)
Using sqlite3-ruby (1.3.3)
Using taps (0.3.23)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem
is installed.
rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. C
onsider using bundle exec.
(See full trace by running task with --trace)
This is probably because you have a newer Rake version on your system. You can do as the error says: bundle exec rake db:migrate which runs rake in your application context (rake 0.9.2), or just delete your Gemfile.lock and bundle again.
The same happened to me, bundle exec of course worked in the Terminal, but RubyMine would not listen. It turned out that the global gemset used the newer rake-version than the my 'local' gem set, I ended up uninstalling rake from the global gemset to make RubyMine happy again (after a restart that is).

Why is rails installing a newer version when I run bundle?

I am trying to start a new rails project and I would like to stick with rails 3.1.3. However, when I run the command rails new projectname I get the following output:
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
...
create config
...
create config/database.yml
create db
...
create public/robots.txt
create script
create script/rails
create test/fixtures
create test/fixtures/.gitkeep
...
create tmp/cache
create tmp/cache/assets
create vendor/assets/javascripts
...
create vendor/plugins/.gitkeep
run bundle install
Fetching source index for https://rubygems.org/
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.0.4)
Using activesupport (3.2.0.rc2)
Using builder (3.0.0)
Using activemodel (3.2.0.rc2)
Using erubis (2.7.0)
Using journey (1.0.0)
Using rack (1.4.0)
Using rack-cache (1.1)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.2)
Using actionpack (3.2.0.rc2)
Using mime-types (1.17.2)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.3.0)
Using actionmailer (3.2.0.rc2)
Using arel (3.0.0)
Using tzinfo (0.3.31)
Using activerecord (3.2.0.rc2)
Using activeresource (3.2.0.rc2)
Using bundler (1.0.21)
Using coffee-script-source (1.2.0)
Using execjs (1.2.13)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.6.5)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.0.rc2)
Using coffee-rails (3.2.1)
Using jquery-rails (2.0.0)
Installing rails (3.2.0.rc2) # WTF?
Using sass (3.1.12)
Using sass-rails (3.2.3)
Using sqlite3 (1.3.5)
Using uglifier (1.2.2)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
I'd like everything to remain version 3.1. Why does the rails command automatically update itself to 3.2.0.rc2? How can I make sure that everything I do is using 3.1.3 versions of everything?
Thanks.
It is relatively little known fact that you can specify the rails version for a new application _like.this_
rails _3.1.3_ projectname
will work assuming 3.1.3 is installed (gem install rails -v3.1.3 otherwise)
This also works with rails 2 apps, i.e. pre-bundler and will create a rails2 looking application in these cases, e.g. rails _2.3.8_ projectname Again gem install rails -v2.3.8 if necessary (i.e. first time usage on that machine).
Longer term make sure you are using rvm (now a defacto standard) and you can use that toset your default rails (as well as ruby).
Removing the old version can be done with sudo gem uninstall rails -v 3.2.0.rc2

Ruby on Rail gem install activerecord-sqlserver-adapter error

I'm trying to run rake commands on my local SQL server database using ODBC. I have setup the ODBC connections and thought I had the rails end covered however, i'm running into this error.
Please install the sqlserver adapter: gem install activerecord-sqlserver-adapter (no such file to load -- active_record/connection_adapters/sqlserver_adapter)
I have the following gems installed:
abstract (1.0.0)
actionmailer (3.0.5)
actionpack (3.0.5)
activemodel (3.0.5)
activerecord (3.0.5, 1.15.6)
activerecord-sqlserver-adapter (3.0.10)
activeresource (3.0.5)
activesupport (3.0.5, 1.4.4)
arel (2.0.9)
builder (3.0.0, 2.1.2)
bundler (1.0.10)
dbd-odbc (0.2.4)
dbi (0.4.1)
deprecated (3.0.0, 2.0.1)
erubis (2.6.6)
i18n (0.5.0)
mail (2.2.15)
mime-types (1.16)
minitest (2.0.2, 1.6.0)
odbc-rails (1.5)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.7.1, 0.6.14)
rack-test (0.5.7)
rails (3.0.5)
railties (3.0.5)
rake (0.8.7)
rdoc (3.5.3, 2.5.8)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.25)
Am I missing a gem? What else do I need to get this running on my windows box?
Thanks in advance for any help :-)
Try to add such line in your %APP_ROOT%/Gemfile
gem 'activerecord-sqlserver-adapter'
Also, your way behind on the times. First the DBI/DBD-ODBC were removed from the adapter stack about a year ago. Also, the easiest way (and best performance) is to use TinyTDS for the connection mode. See there wiki here.
https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Using-TinyTds

Resources