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 Java, but came up with the idea of implementing it on a web based system. Then we came up with a couple questions:

  1. The business couldn’t rely on his ISP stability, as here we have really poor ISP, and the fact of the internet going down would probably ruin the entire night at the pub. The question would be: as if it were developed in 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 be accessed from home. I know it seems to go against some “laws” of web system developing, but would be quite the better solution for us. Or if there is any other ways to manage it locally, without entirely needing an internet connection, in the worst of the cases.

  2. As it is a business, here in Brazil, we have now the option to print the customer’s receipt for his IRS declarations. So the other question would be: if possible, how is this integration from RoR with periphericals, such as printers, would follow? Or if should it be done in anything else such as 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 is 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 this 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 the 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 technologies 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 came up is: is there any known gem to help handling these communication cases?

Again, thanks for the attention.

Regards,

Diego Dillenburg Bueno

A quick update:

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

I was just thinking about doing something really quick like rendering a page that is printer friendly using Rails and just having them hit CTRL+P but if you wanted to bypass that and send it straight to the printer that works too. From a quick Google search it seems the best way is to issue OS 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 better information, 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 works and you don’t mind reprinting or whatever then sending it straight to the 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’

:slight_smile:

Med venlig hilsen Walther

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.

Regards,

Diego Dillenburg Bueno