Importing Existing Rails Application to RubyMine Project - ruby-on-rails

I am currently having unnecessary trouble trying to test out RubyMine. My biggest problem is that I cannot find a way to take a existing rails application on my system and convert it to an official RubyMine application, so that I can experience all of the features of RubyMine.
The only options that are available to me are to either create a new RubyMine rails project, to pull a rails project from a git remote (doesn't work), or to open a previous rails directory (which allows you to edit rails code, but it doesn't recognize this directory as a RubyMine project, so I cannot heap all of the benefits that RubyMine has for rails).
Please help me out, RubyMine seems promising
This is RubyMine 4 btw.

File | Open Directory should create a new RubyMine project from the existing sources. I've just tried with a new Rails app and it recognized it as a Rails project and all the features work just like for the new project created from RubyMine.

Related

problems while running a rails proyect

I am about to continue the project of another programmer and the person who contacted me sent me the code, I just installed all the gems and I am using the correct version of ruby but when doing "rails s" does not start the server, I enter the folder of the project but I see that there are not some folders that are usually in my rails projects at the time of creating the project. How the project is currently running on a server I don't know if they have dispensed with these folders or I'm missing something, the structure of the project is structured in the image, I would be very grateful if you could answer my question.
apparently the project makes use of the rbenv-vars gem

Cannot start the debugger in Rubymine. Rails server launcher wasn't found in project

I was trying to debug a rails application(4.03) using rubymine IDE version 7.0.2, but when I configure my application like this
The IDE complained that Rails Server launcher wasn't found in the project.
Please tell me what can I do fix the issue, and could you please recommend other ways of debugging a rails application.
Please note that this bug is easily replicated using Ruby Mine by following these steps.
Create a new rails projects with Ruby Mine, for example DebuggingRails. Which will generate default folders and files. At this point one can debug the application normally.
Create a new folder let's say Server.
Copy all the generated files above to the Server folder, so the project structure will be
DebuggingRails\Server.
Create a debugging configuration , which points to the DebuggingRails\Server.
Try to debug the application using the IDE.
The message "Rails server launcher wasn't found in project" appears
Thanks.
Close your project, remove the .idea folder, and open it back up again.
I had this problem because i chose the wrong folder, you must choose the root folder in the rails project. For example i had this structure
-MyProject
---RoR
-----app
-----bin
-----condig
-----etc
Then I chose the folder call
MyProject
It was wrong.
The correct is choose the folder
RoR

Railties in Rails 2.3 project?

I've inherited a small Rails project from a new client and unfortunately the previous developer(s) left essentially no information other than the Rails app instance running in production. (No source repository, no documentation, just the login to the production server.)
Inspecting the server shows Rails version 2.3.8 installed (confirmed by the version number in "config/environment.rb") but when I try to run "ruby script/console" (or "server") on my local dev environment I get (essentially fatal) error messages originating from files in "vendor/rails/railties" and searching the internet for "railties" shows a lot of Rails 3 documentation.
I'm guessing that a previous developer/maintainer crossed the Rails 2/3 streams somehow. Should I be ok to just delete the entire "vendor/rails" directory or am I missing something?
What kind of error are you getting? Do you know that your local environment is the same as production? Do other Rails 2.3.8 projects run fine on your machine?
Now, I think it should be fine to remove vendor/rails with the exception being that if the previous developer monkeypatched something in Rails, but directly in the vendor/rails directory. Then, you might have a problem.
This approach might be a bit tedious, but I might go as follows:
Clone 2.3.8 somewhere else on my machine.
Check it in to some form of version control.
Copy your version of 2.3.8 from the project into the newly cloned directory.
Diff it.
This should show you if the previous developer made any changes, both significant and insignificant, to Rails.
Good luck, because this doesn't sound very fun :(

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.

How to import existing ROR project?

I'm new to Ruby on Rails (PHP developer here) and I need to edit an existing ROR project. I've been using Aptana Studio for my PHP projects (switched to Zend after Aptana 2.0) but I've kept Aptana RadRails for my ruby projects.
So what I want to do is to get the ROR project from the server (it's hosted on some linux machine) and import it into RadRails for local development. I've downloaded the files from the server and imported them in a new RadRails ROR project but it doesn't work as intended. Is there anything else I should do ? I've read about 'freezing the gems', switching to production mode and dumping the database for a ROR project upon releasing. Are there some steps needed to undo those operations ?
UPDATE:
The problem that I'm having is that I get various errors when trying to visualize in the browser the pages for different controllers.
ActionController::InvalidAuthenticityToken in
No :secret given to the #protect_from_forgery call. Set that or use a session store capable of generating its own keys (Cookie Session Store).
OR
no such file to load -- xml
This error occurred while loading the following files:
hotels_pro
xml
This leads me to believe that (maybe) I haven't got all the files. On the other hand I have double-checked and I have all the files from the server.
Thanks,
A RoR application is more than just the sum of its source files. There's also the database, gems and a server which exist outside the project directory. Without knowing exactly what doesn't we can only speculate which is causing you problems. Being new to Rails, it's probably all of them. If after all this you're still not up and running a few rounds of "Google the Error" should fix you up.
You'll need to set these things up in your development environment before you can proceed. The following assumes you have a working ruby environment: rubygems installed with the rails, and rake gems. Note any commands and paths that follow are relative to the root of your rails project.
Database:
Start with editing config/databases.yml to find out which database your app will try to connect to. Change it if necessary so it names a local database. Create that database, if it doesn't exist with $rake db:create
If you need existing data to test with you can take a dump from your production database and import it into your working database. How to do this is dependent on the type of database in question. Otherwise you can run the migrations with $ rake db:migrate to produce your development database (assuming the previous developer designed the database with migrations.)
Gems:
Check the config/environment.rb, for your list of required gems. Install all these gems if they haven't been already.
If you're using Rails 2.1 or newer, you can streamline this process by ensuring that all gems are required using the newer config.gem 'this_gem' form instead of older require 'this_gem' declaration. Once all required gems are in this form, you can use $ rake gems:install && rake gems:build to ensure they're all installed.
Server:
Is pretty trivial, all rails instalations come with web brick which is fine for development. But mongrel is also suitable.
P.S. If you're not using some kind of revision control it's strongly advised to set something up before starting. It's not a requirement, but it will likely save your ass at some point.

Resources