Search code examples
ruby-on-railsrubydatabaseconventions

Rails convention on adding database entries from outside source regularly


Say I have a running rails project, and now I need to add entries to its database from an outside source. This is to be done automatically once a day and can be reduced to loading data from a text file.

Now I'm wondering, what is the conventional way to do this in a Rails project? Do I create a controller method which runs once a day and how do I call it? Do I access the database from outside with something like the sequel gem?


Solution

  • I think it depends of your application restrictions and business requirements. My opinion is that both ways are good.

    But I'd prefer to connect directly to database of use some message queue, just to avoid HTTP, to decrease number of HTTP calls.