Cmd line interface for ruby on rails app

Hi,

I have a rails app running which provides an interface to create/update data stored in a DB. How do i develop a cmd line interface to do the same i.e i should be able to retrieve/update data to a DB.

No need to do that, simply use rails console to interact with the DB through Ruby/Rails.

Hi Miguel,

I think that wont serve my purpose, as i'm building a tool which will help clients to update/create entries in the DB. You mean to say every client has to use rails console and connect to the rails server?

You can load ActiveRecord and use it from within a RUBY app without running a Rails server--is that what you mean?

If you're "building a tool", what is the exact question? :slight_smile:

I dont know how it works with out rails server. But what i have now is a) browser based interface to DB to edit/view the records b) Clients can access this remotely

What i want is a) cmd line interface (using a ruby script ?) , so that remote clients can use this app/script to interface with the DB

You *do* understand that a browser works by sending "requests" -- strings -- to the server, right? So define your command line syntax, write the code to take the input and send it to the Rails server like a browser, and handle the server's response appropriately.

Or teach your clients to use Lynx - might be less work :slight_smile:

FWIW,

Well,

That’s why you create APIs for your services.

If you’re developing a mobile client for example you need to developer a REST API.

So, I recommend you look into building a JSON API and have your command line interact w/ it if that’s the way you want to go.

But, I don’t see a point to having a command line interface when a browser is usually a more powerful way of interacting w/ services.