Ruby on Rails: Try as I might, I can't create a RoR project

Desperate for some step-by-step as this just isn't working for me and I can't find any resource that helps me walk this through - I'm new to RoR and Idea.  I want to cretae a brand new project from scratch for RoR development.  In fact, nothing more complext than walking through a RoR tutorial.

For background, I have already run through that tutorial with a simple text editor and cmd line and I had no problems.  RVM is installed and the default Ruby version is 2.2.3.  Rails version is 4.2.5

If I Create New Project, I can select a Ruby on rails project and it brings up the appropriate new project dialog.  When I first tried this, the only Ruby available to me was 2.0.0 (a default OSX version I think) - at that attempt I actually navigated to the ruby in ~/.rvm/..... Now, when I try it does actually give me 2.2.3 [global] as an option, which I select.

Next, Rails version: only option available to me is "Install Gem" (is Select Version an option??).  Anyway whether I leave it as Select Version or Install Rails Gem... the result is the same.  So I select Install Rails Gem...  Why do I need to do this?  Why can't it detect the install of the Rails gem?

Next, the only thing I can do is enter a working directory.  It's not clear what this is for but I enter src/rails/blog.

I can't preconfigure the database which is set to mysql - I have sqlite3 on my mac, not mysql - nor any of the other options so I click next.

Here I enter the name of the project and its directory and click finish.

Whatever it needs to do, it seems to do but I get an error reporting that it couldn't run gem rails (or similar) and I end up with an empty project.  If I look at Project Structure it has a module for RoR but doesn't give me any info.  Project problems are counted at 22 and all seem to relate to a missing path in a variety of Gems.

Just stuck

0
5 comments
Avatar
Permanently deleted user

Even whilst I was creating that post I was trying what were essentially the same steps.  On about the 5th attempt when I selected "Install Rails" it actually prompted me for a version to install 4.2.5!  So I went ahead and installed - it seemed to do something for a certain amount of time, installing gems and then the install dialog just disappeared and I was left with the same two choices (Select version or Install Rails).  so again, the end result is the same.

But restarting Idea and opening a new project, it actually populated the Rails version with 4.2.5 AND it opened up the other options so I was able to select sqlite3.  I entered a working directory src/rails/blog, clicked next and entered a project name and directory ~/IdeaProjects/blog and clicked finish.

It ran and I didn't get the failed to install gem error but instead the Rails generated failed because ~/IdeaProjects/blog/src/rails/blog didn't exist!  I still have 22 project problems: Libraries have broken sources path all seemingly related to ~/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/unicode_normalize [Fix]

Note that in Project Structure, the project SDK is set to 2.2.3 and in Global Libraries many of the libraries are underlined in red with broken paths being the reason.  If I go to the platform settings/SDK and shift that from Ruby 2.0.0 to ruby 2.2.3 and click apply, those red lines disappear.  The 22 problems still remain.

So I removed that attempt and tried again.  This time I DIDN'T set a working directory, left it blank, and it actually ran through with the bundle install and created what I was expecting - a RoR directory structure.  Of course, these are all directly under the project root and not in something like /src and that doesn't seem right to me.
In Project Structure, the Project SDK is 2.2.3; the platform settings SDK is 2.0.0; in Global Libraries a bunch of Gems are underlined in red with "Invalid classes roots" and "invalid sources roots" and I have 22 problems as noted above.

I have no idea what I'm doing wrong here so I'd really appreciate some help.  I can't tell if it's because there are some underlying bugs in the IDE, some problems in the config of my install of the IDE or of RVM and ruby/rails/gems.  

0

Hello Andrew!

we've submitted a corresponding issue regarding working directory, please vote for it:

https://youtrack.jetbrains.com/issue/RUBY-17524

As for SDKs, just to clarify - for Ruby SDK 2.2.3 the language level in Platform Settings | SDKs is 2.0.0? What Ruby plugin version do you have? Please try to readd this SDK to the list (checking that the language level is determined correctly)

0
Avatar
Permanently deleted user

Hi Olga,

I think what you are saying is use the workaround: pre-create the structure through Finder before creating the project.  However, there are other issues with that (once the project is created, Bundler looks for Gemfile in wrong location and Rails console is missing!)  

Re: your point about SdK and language level
At my first ever attempt to create a RoR project the SDKs IDEA knew about where:
2.0.0
RVM: ruby-2.2.3
RVM: ruby-2.2.3@global
(not exact names)  Actually, I had removed the 2.0.0 SDK from my machine but IDEA still "knew" about it (this in Platform Settings>SDKS).  So when I created the first RoR app, it only prompted me with SDK 2.0.0 or to install - the other's were not in the list.  Also, no RAILS version was prompted for.  This happened 5 or 6 times then, for some unknown reason, it started prompting me with 2.2.3 and 2.2.3@global as well.  It also then started giving me a prompt to install a RAILS Version as well tinstead of just failing.

So I'm past that bit now as it at least reports and uses installed RVM SDK and RAILS version.  I have removed the 2.0.0 SDK from the Platform Settings AND removed all old gems from the Project Settings > Global Directory that IDEA seemed to "remembering" to clear that up.

Now I have the following SDKs installed in Platform Settings:
RVM: ruby-2.2.3
RVM: ruby-2.2.3@global

Both of these are language level 2.2 (a drop down box that is not selectable).  I added an SDK: navigated into the .RVM rubies directory and selected the 2.2.3 ruby and that appeare in Project Settings as
ruby-2.2.3-p173 language level 2.2

I don't know how to set the language level as the associated drop down is not selectable.

Regards,

Andrew

0

Hi Andrew,

a workaround for the moment would be not to use Working directory, in this case it should work properly.

The language level is set automatically, but sometimes there might problems in its defining, that's why I've asked about current language level.

0
Avatar
Permanently deleted user

Lol....that's some workaround, it's certainly made me laugh!  You're right, it works perfectly without it and I can live with that.  Hopefully, that feature will make it into a future version as it is part of the help (and obviously the current dialog!)

Thanks Olga

A

0

Please sign in to leave a comment.