Your script seems to be in the body of the Blog model.

For what you're trying to do, I suggest that you create a class
method in Blog to publish entries e.g.

def self.publish_entries
  # your code goes here
end

which you can then invoke with Blog.publish_entries

Also, the way you are trying to do it is database intensive.
The initial search to get new entries is a hit on the db.  Then
each call to save will hit the db again.

I recommend looking up update_all in the Rails API

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to