On Friday, May 19, 2006, at 7:33 AM, Glenn Cadman wrote:>I want when the user clicks on a button on the browser
>"Perform monthly billing run" the controller to lanch a sql DML
>statment to be called (in the model?) than runs something like
>
>"insert into billing (item, qnt, total_cost, billing_run_timestamp
> select item, qnt, item*cost as total_cost, timestamp
> from services
> where service_end_date is null"
>
>How can I run a DML (insert, update, delete) direct sql statement ?
>
>--
>Posted via http://www.ruby-forum.com/.
>_______________________________________________
>Rails mailing list
>Rails@lists.rubyonrails.org
>http://lists.rubyonrails.org/mailman/listinfo/rails
Item.connection.execute("select count(*) from items")
or generally:
<Model>.connection.execute(<SQL>)
--
Posted with http://DevLists.com. Sign up and save your mailbox.