This Question is Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
3 Replies Last post: Apr 29, 2014 2:55 PM by Andrey Vokin  
Louis-Philippe Carignan Newbie 5 posts since
Apr 19, 2014
Currently Being Moderated

Apr 19, 2014 3:07 AM

Generating a model with a SQLite3 database

Hi all,

 

I'm new to RubyMine, Ruby and Rails so bear with me.

 

I'm looking for a tutorial on how to generate my model in RubyMine from a SQLite3 database. I've created my SQLite3 database (2 tables). It seems like RubyMine can connect to it as it can display the 2 tables in the database pane on the right side of the RubyMine window.

 

But now, I would like to generate the model from this database. By generating, I mean populating two .rb file, each one with a class deriving from ActiveRecord. Is it possible to do so with RubyMine?

 

Or do I have to do this by myself? A tutorial on this topic, ignoring the exact type of database, would be appreciated for a beginner. Maybe how the whole thing connects together in the background would also be good. How do I configure my database.yml file? Do I have to add a line of code then in the rest of the application where I connect to the database? Or does all of this is done by magic when I load a database in the database pane on the right side of the RubyMine window?

 

Thank you,

 

Louis-Philippe

Andrey Vokin JetBrains 92 posts since
Jun 17, 2011
Currently Being Moderated
Apr 24, 2014 1:30 PM in response to: Louis-Philippe Carignan
Re: Generating a model with a SQLite3 database

Tools -> Run Rails Generator. Choose model. And int the dialog type tablename (in camel case)

Andrey Vokin JetBrains 92 posts since
Jun 17, 2011
Currently Being Moderated
Apr 29, 2014 2:55 PM in response to: Louis-Philippe Carignan
Re: Generating a model with a SQLite3 database

You could read our Quick Start Guide: http://www.jetbrains.com/ruby/quickstart/ so that to get familiar with core functionality of RubyMine. Also you could look at documentatin: http://www.jetbrains.com/ruby/documentation/

More Like This

  • Retrieving data ...