Chronicling my experiences with ruby on rails, web application development/management.

Wednesday, December 3, 2008

Theme Support plugin update for Rails 2.2- Part 2.

So i have tried my damnedest to make this work. I get an error as follows:

undefined method `compute_public_path' for #
So, for some reason in theme support i am getting this crazy error, where in Rails 2.0.2 i did not, and in another project, which was Rails 2.1.2 using the "old" theme support, i did not get either


Possible Solution (TBD)

It appears that the compute_public_path method is now a private method of the class AssetTag in the module ActionView::Helpers::AssetTagHelpers.

What I still need to figure out


How in the hell do i link this 'sub class' AssetTag to the Module line in the rhtml_helpers.rb file in theme_support? I've tried various configurations to no avail. Who out there is a plugin god and can help out?

2 comments:

  1. In 2.0.2 compute_public_path was also private....

    got the same problem when upgrading to 2.2... in a wiki formatting textile helper ..

    link_to( I18n.t(:label_help), compute_public_path('wiki_syntax', 'help', 'html'), :onclick => "window.open(\"#{ compute_public_path('wiki_syntax', 'help', 'html') }\", \"\", \"resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes\"); return false;")

    let us know if yu find a trick ... will do the same...

    ReplyDelete
  2. hi kadoudal. I was able to fix this error in my version of theme_support, however i needed to basically 'lift' the whole ActionView::Helpers::AssetTagHelpers file and put it into my plugin. However, since you are using compute_public_path in a js call, maybe you will have luck with the public_path method that ActionView::Helpers::AssetTagHelpers gives you access to in the AssetTag class. here is an example :
    def public_path
    segments = [theme_name, directory, @source]
    compute_public_path(File.join('/themes', *segments))
    end

    It turns out the problem for me was that compute_public_path was added to a Class within ActionView::Helpers::AssetTagHelpers that made it hard to access without copying the whole file over to my plugin and tweaking it as needed.
    I know it's not the silver bullet you wanted, but maybe it will help?

    ReplyDelete