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

3 comments

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

0

Thanks Andrey for the answer. This is exactly what I was looking for.

Is there some kind of series/tutorial/walkthrough to discover those features and what they offer.

For example, the feature discussed in this thread is used quite often with RoR. With similar commands (Ex: migration, rake db:migrate), maybe the developer who was doing it from the command line would appreciate how he can be become more productive with RubyMine.

Just an idea,

Louis-Philippe

0

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/

0

Please sign in to leave a comment.