Rails novice with a new project!

Hi!

I am embarking on my first ever rails project (yay!) and would like to
solicit any advise or warnings while I’m in the planning stage. Here
is the impetus for my project:

I am product supply manager at a small research company. I inherited
a really clunky, buggy inventory management system. It is basically a
hastily assembled front-end someone put together in visual studio with
a SQL Express backend database. The front-end generates constant bugs
and like the database behind it was simply not designed for our work
flow. I’ve tweaked the system as much as I can in the back-end(I
don’t have source code for the front end), but I’m sick of dealing
with it. I’m ready to start from scratch.

Reading through the zeitgeist (aka google) I’ve become attracted to
Rails for implementing my project. I need a quick uptime and a kind
learning curve, as I will be doing all the coding myself. I have done
a little java, vbasic and c so I’m familiar with the basics of object-
oriented programming and I’ve found the ruby tutorials I’ve been
working through to be quite accessible. I have a pretty good idea
just from learning the basics how I can set up the system I envision,
but there are a couple details where I really have no idea of Rails’
capability.

In particular, I would like both pc’s and mobile devices to interact
with my database on an almost-equal footing. Workers should be able
to quickly identify and perform transactions on inventory items by
scanning their barcodes and the database should be updated remotely in
real time. Is it possible to interact with hardware components of a
mobile device (like a camera or scanner) from the context of a web
browser and use it in a meaningful way through Rails?

I’d also appreciate anyone who can point me toward helpful resources
for developing business intelligence apps in Rails.

Apologies in advance if this is a stupid question, I’m very new to
this :slight_smile:

On Jan 23, 2011, at 8:32 PM, Josh M wrote:

Is it possible to interact with hardware components of a
mobile device (like a camera or scanner) from the context of a web
browser and use it in a meaningful way through Rails?

Wow, this looks like a tall order right there. I know on the desktop,
the bar-code readers I have seen are very simple to integrate, because
they just “type” the letters of the bar-code very fast. So your
interaction is simply to get the cursor into a text field (using
JavaScript) and then let the user press the trigger on the scanner. A
stream of text ensues, as the scanner pretends to be a keyboard over
USB.

But what you’re describing seems to be out of the realm of a mobile
browser. For one, I don’t know if the sandbox rules allow a Web page
to access the camera. For another, you’d need to upload the resulting
photo to the server and let some sort of image processing system read
the code. Your only other alternative would be to have a custom app
for each supported platform which could present a WebKit window to
interact with your Rails app alongside a camera button and client-side
barcode reader (think the eBay app on iPhone for example) in order to
pull this together.

The rest of your question seems like something you can handle in a
green-field Rails app. Export your data out of the fancy-pants Access
format and into PostgreSQL or MySQL or something – anything – else.
And while you’re doing that translation, look carefully at any foreign
keys or primary keys and coerce them into the Rails format so you
don’t have to use the key-mapping features first time out of the box.

Walter

quick list of some hopefully helpful things. I’m very noob myself at
this point, but having covered the material below, after two months of
study, I’m saying to myself, “hey looks doable. no biggie.” if anyone
here sees me pointing Josh M in the wrong direction, speak up.

a great crash course is http://mislav.uniqpath.com/poignant-guide/ for
the aspects of ruby. I fiddled with this for a month and played around
with ruby before going into rails. But, a good exercise so I could
distinguish the fundamentals of what was actually going on in rails.

rails for zombies is a great tutorial crash course, coupled with agile
web development and rspec o’reilly books, and of course, The Pick Axe.

heroku makes implementation very painless. true, your inventory
control would be in the cloud, but authentication doesn’t seem to be a
big hassle.

gl,
p

Josh M wrote in post #977046:

Is it possible to interact with hardware components of a
mobile device (like a camera or scanner) from the context of a web
browser and use it in a meaningful way through Rails?

Hi, the answer is yes partially. Or actually yes.
The practicalities require some research from your side.

You can use cross-platform development environments for mobile.
You get access to many HW features of most of the mobile plaforms, iOS,
Android, BB, etc. Meaning you can access Camera, Accelerometer, local
storage, etc from a browser object. I said yes partially because
typically you’d create an installable application for the device which
uses a browser object to display itself. So in practice you show HTML
pages that use Javascript with some extra access to HW provided by the
frameworks you use, for example Titanium Mobile from Appcelerator,
Phonegap or Rhodes from Rhomobile for us Ruby fans.

None of the platforms provide the reader as far as I know. I think
Titanium was planning to add support for that but don’t know when. But
you can maybe use the one I mention below and make a plugin that the app
would use. That is possible.

Some info about such platforms here:
http://bit.ly/ifhRA4 and here http://bit.ly/bzcuvK

An open source project of a reader for Android here:
http://code.google.com/p/zxing/

Luckily there’s plenty of stuff to get into Rails. Make sure you drop by
http://railscasts.com/

Hope it helps.

Cheers.

Thanks so much for the helpful responses, you’ve given me a number of
excellent resources to check out!

@ comopasta:
Rhodes looks like a good option. In fact their website mentions
barcode readers specifically. Also, we’re currently using a couple
purpose-built windows mobile based mobile barcode scanners and Rhodes
claims support for Windows Mobile. In any event, I’ve got plenty of
more basic work to take care of before I get to this portion of the
project, so I’ll have time to check out a few different development
environments!

@pedro:
Rails for zombies was great, it gave me a taste for it (also for
brains), also I was just working through the (poignant) guide to ruby
last night, and did find it helpful to a point. After a few chapters
all the cartoony stuff got to be distracting! I looked up the Pick
Axe though and I think I’ll be running to the bookstore to pick that
one up soon.

@Walter
I’ve already decided I’m scrapping the existing table associations and
starting fresh, so no worries about fixing broken keys! I think the
developers made some weird decisions with how they related their
tables and I have a simpler approach. I was thinking I’d migrate from
the built in sqlite to MySQL when deployment time comes. Are there
any comparative advantages/disadvantages of MySQL compared to
PostgreSQL or any of the other options I should be aware of?

Please quote when replying.

Josh M wrote in post #977301:
[…]

@pedro:
Rails for zombies was great, it gave me a taste for it (also for
brains), also I was just working through the (poignant) guide to ruby
last night, and did find it helpful to a point. After a few chapters
all the cartoony stuff got to be distracting!

Agreed. The Poignant Guide is a fun read, but I didn’t find it terribly
helpful for learning Ruby.

I looked up the Pick
Axe though and I think I’ll be running to the bookstore to pick that
one up soon.

There’s an old but still useful version for free on the Web.

@Walter
I’ve already decided I’m scrapping the existing table associations and
starting fresh, so no worries about fixing broken keys! I think the
developers made some weird decisions with how they related their
tables and I have a simpler approach.

You must use foreign key constraints in your database to prevent keys
breaking. The Foreigner gem is the essential tool to make this work
well with Rails.

I was thinking I’d migrate from
the built in sqlite to MySQL when deployment time comes.

There are several bad assumptions in here. SQLite is not “built in”,
and it has somewhat different syntax from MySQL or Postgres. It’s often
very useful for getting a quick start, but you’ll need to switch at some
point.

Also, “deployment time” should be constant. You should be deploying
incrementally from the very first, even if only to a staging server.
Don’t wait – that will put you into integration hell.

And of course, do all development test-first. Cucumber, RSpec, and
either Machinist or Factory Girl should be your constant companions.

Are there
any comparative advantages/disadvantages of MySQL compared to
PostgreSQL or any of the other options I should be aware of?

PostgreSQL is a much better DB than MySQL – MySQL really has no
advantages over it at all, except slightly easier setup. I wouldn’t
consider MySQL for most new projects.

(If you deploy to Heroku – which you should if possible – you get
PostgreSQL.)

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs