Search code examples
ruby-on-railsrubyruby-on-rails-4

Make custom commands for ruby on rails


I want make new command line program for my ruby on rails application, but I can't found how I can make new command. I mean, this functional analogue in RoR.

Help me please, and tell me please how I can fix my problem.

Thanks a lot.

P.S. sorry about my English.

ADD1: I want create backend script for parse xmls and save its in database. I think, will be very good if I can use AR classes from my RoR application.


Solution

  • For command line prog just use rune as follows :

    rails runner "model.method"
    

    as in case of console and server you can also mention the environment for running.

    For parsing xml there a lot of options like LibXML.