Would love to hear feedback regarding my first Rails project

Hello,

I just finished a first alpha version of my first "real" Ruby on Rails project, Platfom Health Viewer.

My main goal is to make data visualizations like "what was the CPU load of our database system in the last 60 minutes?" or "How many user logins were performed on our website in the last 24 hours?" lightweight and simple to setup and display.

The main use case is to feed numeric data into the system using simple HTTP calls, organizing this data to simple or combined data groups (dubbed "tags"), and to create and manage a dashboard view of graphs visualizing this data.

The application is build on Rails, the server used for data collection is done in node.js, the web interface makes heavy use of jQuery and uses Raphael for creating SVG graphs. Mass data is saved in an SQL db, other data is stored using CouchDB.

I've created a short screencast showcasing the basic usage. A funny voice and lots of grammatical shortcomings are included for free:

I would love to hear feedback from this list regarding the (Ruby) code. Being new to Rails and Ruby, I'm still trying to get a feeling for what the "best" Ruby/Rails way for certain scenarios is. You can find the code at:

For example: Is /script the right place for my supporting bash scripts? Does

have to much logic?

Any feedback is highly appreciated.

Regards,

That’s a pretty cool application. Overall it looks really good for a first Rails app.

I don’t think theres anything wrong with putting bash scripts in /script.

As regards _frame.html.erb, I think there is too much logic in it. While you might be able to clean it up by moving some of the code [lines 33-43] into helpers, maybe you should look at using something like cells (http://cells.rubyforge.org/) to make each frame into a component that has views and logic.

Also I would always try and avoid inlining the javascript as you have done. What I would do is store the attributes of the frame in the html and have one javascript function in an external file find those attributes automatically.

E.g.

// html

500
200

// js in $(document).ready $(‘.frame’).each(function(i, frame) { id = frame.attr(‘id’).replace(/frame-/, ‘’); width = frame.find(‘.width’); height = frame.find(‘.height’); drawChartForFrame(id, width, height, otherdata…); });

Something like that.

I also see you have an empty.html.erb, that shouldn’t be necessary. You can do render :layout => false if you don’t want to use a layout.

Thanks Dermot, really cool you took the time to go into detail, that helps a lot.

I will rewrite stuff as you suggested, and I will look at Cells!