General Information About RoR

Dear Rail Developers,

I’m kinda new to the RoR world and would appreciate if someone with the
knowledge helped me out sorting some things.

I got a new project that I’m supposed to do but came up with some
questions, it’s basically a system to manage a Pub with basic
funcionalities like inventory control, cash flow and client controls
(probably with a bar code card).

Firstly we thought of doing it desktop based, in something like C# or
but came up with the idea of implementing it on a web based system. Then
came up with a couple questions:

  1. The business couldn’t rely on his ISP stability, as here we have
    poor ISP, and the fact of the internet going down would probably ruin
    entire night at the pub. The question would be: as if it were developed
    Rails, what would be the praticability to run it in a local server
    primarily, but exporting it to a remote server everyday so it could also
    accessed from home. I know it seems to go against some “laws” of web
    developing, but would be quite the better solution for us. Or if there
    any other ways to manage it locally, without entirely needing an
    connection, in the worst of the cases.

  2. As it is a business, here in Brazil, we have now the option to print
    customer’s receipt for his IRS declarations. So the other question would
    be: if possible, how is this integration from RoR with periphericals,
    as printers, would follow? Or if should it be done in anything else such
    js. Honestly, I have no clues yet on how to do so.

Will appreciate any help given!

Thanks in advance,
Diego Dillenburg Bueno

Hey Diego,

First, there is nothing wrong with running a local web server and just
having your browsers access it. Since the only users of your application
are going to be those on the same network it really doesn’t matter if it
hosted externally or internally and since the Internet going down is an
issue I would go ahead with your idea to just host it locally.

Second, since it is a web application and would be accessed through
browsers it would have access to any peripherals the computer had. In
case when you print a web site or PDF it doesn’t matter where that came
from but that it is open in your browser. This means you can generate
receipts in a new window/tab and just have them hit print.

Hey Eric,

thanks for the attention, really helped me sorting out on what
to use. We were fearing that it would end out looking like some kind of
“poor job” building it on a local server.

As of the integration with periphericals I hadn’t thought about this
approach, it seems pretty straight forward, but another question that
up is: is there any known gem to help handling these communication

Again, thanks for the attention.

Diego Dillenburg Bueno

2014-08-04 12:46 GMT-03:00 Eric S. [email protected]:

I was just thinking about doing something really quick like rendering a
page that is printer friendly using Rails and just having them hit
but if you wanted to bypass that and send it straight to the printer
works too. From a quick Google search it seems the best way is to issue
commands using Ruby and sending it a generated PDF file. Here is a
Stackoverflow link about it but I’m sure more searches will reveal
pdf - Printing a file to a printer in Ruby - Stack Overflow.
The only reason I would do it the other way is just to allow the user to
preview the file before it is sent to the printer but if everything
and you don’t mind reprinting or whatever then sending it straight to
printer would be faster for the user.

Hope that helps.

You could start CUPS on the local webserver and attach the printer to
cups and print the receipt in a delayed_job with a system call a la ‘lp
-d printer_name rendered_pdf_file_name’


Med venlig hilsen

Thank you guys for the information provided, it was really helpful! I’m
going to research a little more in this subject and in the topics you
provided me.

Diego Dillenburg Bueno

2014-08-04 16:52 GMT-03:00 Walther [email protected]:

A quick update:

it seems that the printer manufacturer provides a integration tool built
a dll file. If that is of any help towards the solution.

2014-08-04 14:22 GMT-03:00 Diego Dillenburg Bueno
<[email protected]