Rails console in Netbeans - ruby-on-rails

Netbeans ide has rails console? I use Netbeans for PHP for a long time, and now I want use to my Rails applications. I saw the generators, bundle has a fast gui menu, but can I use this commands myself in Netbeans, so I looking a built in console.

right-click on the project in ur Project window, u will see a selection called "Rails Console"
-edit-
if you want shell, terminal. you might have to launch it will cmd, ssh or whatever way to access it.
--edit 2--
you might can check this out:
http://wiki.netbeans.org/FaqRubyTerminalEmulator

Related

How to run ruby on rails application in RubyMine IDE

In python/flask, file app.py can be called from an IDE or the console to run an entire web application.
In Ruby on Rails, I use bin/rails server in the console to start a server to run the rails app, but I am having a hard time doing the same in RubyMine IDE. I tried running application_controller.rb file, but nothing happened.
Which file should I run in IDE to start the server and see the web app in action?
To run a Rails server from the reference Ruby Mine Doc
Press Shift+Alt+F10, and choose the desired Rails run/debug
configuration type.
If necessary, change the run/debug configuration settings. To do
that, choose Edit configurations... in the Run popup menu, and
choose the desired Rails configuration type. Rails run/debug
configuration dialog box appears.
In this dialog box, modify the desired settings. For example,
RubyMine suggests WEBrick as the default Rails server. You can
select a different server from the list of supported servers.
Click the I> button on the main toolbar.

Could I run a Rails Server and type commands to my Rails Project through terminal at the same time?

I'm running my rails server through the terminal by typing rails server. After this, it seems the terminal is unavailable for further commands, but I would like to run some tests by typing rake test without having to CTRL + C out of my server, then rake test, and finally turning my server back on with rails server. Is there common solution for this?
I would also recommend using several tabs or even a terminal multiplexer such as tmux. However you could very well send the server process to the background with
rails s &
This will most likely clutter up your terminal with lots of log output unless you suppress the output as described here. You can foreground the process by typing
fg
and even look at the logs in a different terminal by typing something along the lines of
tail -f log/development.log
Depending on your terminal you can use File->new tab, or maj+ctrl+t to pen a new tab.
Personally i have one tab for the server, one for the tests using guard, one for the console and one to have an actual shell.

How To:Debugging Rails 3.1.x app(Ruby 1.9.3) on Aptana Studio3 in Ubuntu

Is rails debugging supported on Aptana Studio 3. I have earlier debugged Rails applications on Aptana Studio2 with the embedded browser and embedded servers.
1)How to start rails application in Debug Mode?
2)How to enable remote debugging in firefox?
My work environment is as follows and I have been using RVM
Rails 3.1.x
Ruby 1.9.3
Ubuntu 10.10
I have already installed the debug related gems
ruby-debug-base19 (0.11.25)
ruby-debug-ide19 (0.4.12)
Try removing (commenting out) ruby-debug-base19 from Gemfile. "ruby-debug-ide" should be enough, judging from the comments from a post on different IDE - RubyMine.
For debugging, right click on the project and select "Server Debug", then open the site manually in firefox (you will see the address/port the server listening to in the console). I did not manage to set a breakpoint this way, but I only had a test project with no logic in it, so I am not sure how well it works on a real project.
Not sure about your question on "remote debugging with Firefox".
Answer for Q1: Aptana is just an IDE which provides you a not bad interface to input code. I don't think it a very good idea to 'DEBUG' in it.
For me, debugging rails depends on : command line, unit tets and log files. you should first of all, write an failed unit test, then run it in the command line, and write the implementation code, then run unit test, then write implementation code ... sometimes you need to check the output/log file, finally , the unit tests bar turns to green and your code is implemented.
hope this post useful to you:
How to configure aptana for instant running of my script
Answer for Q2: I don't know your "remote debugging in firefox". If you want to show detailed error message to someone else, just start your server as "development" mode. e.g.
rails s -p 3000 -e development
or just:
rails s

NetBeans hangs up while creating a Rails project

I'm using NetBeans and I'm trying to create a new Rails project trought the wizard, so while I click the finish button, it creates the folder structure but the wizard never finish working and doesn't show nothing on the Projects view.
It just happens when I set up a Sqlite3 DB.
I'm using Rails 3.0.7
Can someone help me?
I have always struggled to create Rails projects using the internal netbeans wizard. Usually I find it easier to create the rails app from the command line:
rails your_app_name
This will create a new folder your_app_name in your current location, and then I create a new project within Netbeans by selecting the 'Ruby on Rails Application with Existing sources' option. And select the freshly created your_app_name folder for the Project folder.
I have found Netbeans to be less reliable with rails 3+ applications than the 2+ and find that run most rails commands directly from the terminal/command prompt.
do you have sqlite3 installed? Anyways people will be able to help you if you can post the netbeans log. Go to the command line and run netbeans from the command line. Then you can see a lot of output/logging info.

Ruby on Rails: How to start the WEBrick server automatically on Windows in background?

In order to run the my Rails application on Windows XP I open a command line, cd to application's directory, and then run rails server.
I would like to automate this, such that every time I turn on my computer, all I'll have to do is to type localhost:3000 in a browser.
How could I do this ?
The simpler way is to create a batch file with the instruction what you give in the command prompt like
d:
cd projects\myapp
ruby script\server
and then drop a copy of the file to Windows Start -> All Programs -> start up folder.
You have few possibilities to do that.
using the registry you can use HKLM\Software\Microsoft\Windows\CurrentVersion\Run or the better approach would be to create a service, you can see this KB with some instruction how to make a service of whatever executable you want.
have you thought about , AUTOEXEC.BAT or creating some batch files. you create right cmd commands that are run at start up. http://www.aumha.org/a/batches.php
The best approach is turn your application into a service. There is a solution for Mongrel (a web server similar to webrick) called mongrel_service, but is not compatible with Rails 3 (due several changes of Rails internals)
However, you can repurpose mongrel_service codebase to work with thin, another webserver that works with Rails 3.
Please look here where is the only reference to mongrel_service script. changing it to thin start could work.
Perhaps is not the answer you're looking for (as there is some work to be done) but is something :)
start rubyw script/rails server webrick
start -> start in another console
rubyw -> run ruby detached from console

Resources