Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Instant RubyMine Assimilation

You're reading from  Instant RubyMine Assimilation

Product type Book
Published in Nov 2013
Publisher Packt
ISBN-13 9781849698764
Pages 66 pages
Edition 1st Edition
Languages
Author (1):
David L. Jones David L. Jones
Profile icon David L. Jones

Monitoring your extremities (Become an expert)


RubyMine has more tools that let us manage all aspects of our programming projects. This recipe will concentrate on configuring and using the built-in database tools in RubyMine.

Getting ready

Open your Progeny Rails project that we created earlier in RubyMine.

When the project opens, there will likely be a window that comes open like the following:

Click on the link and RubyMine will download and install some Java database drivers so that it can access your Sqlite database (or whichever you are using) from your existing Rails project.

How to do it...

Directly accessing your database fields and structure is much more efficient when we have a nice tool to list and modify our records. RubyMine has the ability to show the tables from your environment directly in the interface, so there is no need to open another tool. Perform the following steps for monitoring your extremities:

  1. Click on the Database button on the left side of the RubyMine main frame. This will open a panel that looks like the following:

  2. Click on the panel and then use the command code as described in the window. (This will be different for each operating system).

  3. Select the menu item Import from sources … and then hit OK from the next window.

  4. Click on the table that shows and open up each level.

  5. Double-click on the id element of the Species table and we will see a window like the following:

    This allows us to view, add, modify, and delete records from our tables easily.

  6. Click on the + icon, we will then be able to manually add another record to our database.

    If we double-click on one of the cells, we can modify the values that are stored in the database. This is a quick way to edit some mistakes that we made when entering data or to test out a part of our interface. Let's add another record via the table editor.

  7. Click on the + icon and enter the following information into the cells of the new blank row that is created:

  8. Now we have two species in our database. We can edit these items as we please, but please note that updates do not automatically change the updated_at field. This is done through the Rails system as it saves a record and we are bypassing that framework completely using this system. We are talking directly to the database.

  9. RubyMine also gives us a nice interface to perform direct database queries on our data tables directly.

  10. Open the database console by hitting the icon Database Console at the top of the Database panel. This opens a window in the main editor panel that lets us type SQL queries directly and execute them to get a dataset back, as you can see in the following screenshot:

  11. Type the following in the console window:

    select * from species where assimilated = 'f'
    
  12. Select the green arrow button right above the text in the editor panel. Don't select the green arrow which runs a specific configuration.

    The results of this direct query will now show at the bottom in a new panel with a database table editor like we had before. It will look something like the following screenshot:

    We selected all of the species in our table that have not yet been assimilated. We can now remedy that easily.

  13. Double click on the f letter in the assimilated column.

  14. Change that to t.

See how easy it is to assimilate other species?

Notice that when you changed the field, it disappeared. This is because our query was executed again and found no more species left to assimilate in our database table. Our job is done. We can return to the collective.

arrow left Previous Chapter
You have been reading a chapter from
Instant RubyMine Assimilation
Published in: Nov 2013 Publisher: Packt ISBN-13: 9781849698764
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}