Skip to main content

Running scripts with rails script/runner

  • strict warning: Non-static method view::load() should not be called statically in /var/www/vhosts/litzastark.com/sites/all/modules/views/views.module on line 906.
  • strict warning: Declaration of views_handler_argument::init() should be compatible with views_handler::init(&$view, $options) in /var/www/vhosts/litzastark.com/sites/all/modules/views/handlers/views_handler_argument.inc on line 744.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /var/www/vhosts/litzastark.com/sites/all/modules/views/handlers/views_handler_filter.inc on line 607.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /var/www/vhosts/litzastark.com/sites/all/modules/views/handlers/views_handler_filter.inc on line 607.
  • strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /var/www/vhosts/litzastark.com/sites/all/modules/views/handlers/views_handler_filter_boolean_operator.inc on line 159.
  • strict warning: Non-static method view::load() should not be called statically in /var/www/vhosts/litzastark.com/sites/all/modules/views/views.module on line 906.
  • strict warning: Declaration of views_handler_filter_node_status::operator_form() should be compatible with views_handler_filter::operator_form(&$form, &$form_state) in /var/www/vhosts/litzastark.com/sites/all/modules/views/modules/node/views_handler_filter_node_status.inc on line 13.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /var/www/vhosts/litzastark.com/sites/all/modules/views/plugins/views_plugin_style_default.inc on line 24.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /var/www/vhosts/litzastark.com/sites/all/modules/views/plugins/views_plugin_row.inc on line 134.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /var/www/vhosts/litzastark.com/sites/all/modules/views/plugins/views_plugin_row.inc on line 134.
Posted in

Lately I've been needing to write short Rails scripts to make changes and updates to items in the database and associated images. I repeatedly tried to create a freestanding script and then run it with "ruby script/runner [script-name]," to no avail.

In the end, my solution was just to put the script into the model file of one of my objects, then run it with "ruby script/runner [Object].[method]" -- this worked like a charm!

(I don't know if these problems are a side effect of the fact that this Rails project is running on a very old version of the software -- I don't remember having problems like this when I was setting up cron jobs and the like several years ago.)