Franz,


 I started out by defining "publish_entries" in the model of Blog and
got the ugly "method_missing" error when I ran
"script/runner script/set_blogs_to_published.rb".

Of course , this is how my "script/set_blogs_to_published.rb" looks
like.

---------------------------- script/set_blogs_to_published.rb - Start
-------------------
class Blog < ActiveRecord::Base
    Blog.publish_entries
end
---------------------------- script/set_blogs_to_published.rb - End
-------------------

I then moved "publish_entries" to the Blog controller file but still
no luck when I ran "script/set_blogs_to_published.rb".



  Where do I put the "publish_entries" definition (ie controller or
model of Blog)?




On Apr 8, 12:35 am, Franz Strebel <franz.stre...@gmail.com> wrote:
> Yourscriptseems 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

-- 
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