New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined methods `cms_cms/page_templates_path' and `cms_cms/page_partials_path' when i tried to edit partial or template (browsercms 3.4) #471

Open
UlfR opened this Issue Feb 2, 2012 · 4 comments

Comments

Projects
None yet
5 participants
@UlfR

UlfR commented Feb 2, 2012

Master commit c0b85c0

When i try to edit partial or template
( http://localhost:3000/cms/page_templates/2/edit and http://localhost:3000/cms/page_partials/4/edit urls)
i receive undefined method errors:
Message

undefined method `cms_cms/page_templates_path' for #ActionDispatch::Routing::RoutesProxy:0xbbe8358

Stacktrace

/usr/local/rvm/gems/ruby-1.9.3-p0@bc/gems/actionpack-3.1.3/lib/action_dispatch/routing/routes_proxy.rb:30:in method_missing' /usr/local/rvm/gems/ruby-1.9.3-p0@bc/gems/actionpack-3.1.3/lib/action_dispatch/routing/polymorphic_routes.rb:127:inpolymorphic_url'
/usr/local/rvm/gems/ruby-1.9.3-p0@bc/gems/actionpack-3.1.3/lib/action_dispatch/routing/polymorphic_routes.rb:133:in polymorphic_path' /usr/local/rvm/gems/ruby-1.9.3-p0@bc/bundler/gems/browsercms-c0b85c0f36ad/app/helpers/cms/path_helper.rb:10:incms_index_path_for'
/usr/local/rvm/gems/ruby-1.9.3-p0@bc/bundler/gems/browsercms-c0b85c0f36ad/app/views/cms/dynamic_views/edit.html.erb:2:in __usr_local_rvm_gems_ruby_______p__bc_bundler_gems_browsercms_c_b__c_f__ad_app_views_cms_dynamic_views_edit_html_erb__713174666_90296600' /usr/local/rvm/gems/ruby-1.9.3-p0@bc/gems/actionpack-3.1.3/lib/action_view/template.rb:171:inblock in render'

and

Message

undefined method `cms_cms/page_partials_path' for #ActionDispatch::Routing::RoutesProxy:0xade2e0c

Stacktrace

/usr/local/rvm/gems/ruby-1.9.3-p0@bc/gems/actionpack-3.1.3/lib/action_dispatch/routing/routes_proxy.rb:30:in method_missing' /usr/local/rvm/gems/ruby-1.9.3-p0@bc/gems/actionpack-3.1.3/lib/action_dispatch/routing/polymorphic_routes.rb:127:inpolymorphic_url'
/usr/local/rvm/gems/ruby-1.9.3-p0@bc/gems/actionpack-3.1.3/lib/action_dispatch/routing/polymorphic_routes.rb:133:in polymorphic_path' /usr/local/rvm/gems/ruby-1.9.3-p0@bc/bundler/gems/browsercms-c0b85c0f36ad/app/helpers/cms/path_helper.rb:10:incms_index_path_for'
/usr/local/rvm/gems/ruby-1.9.3-p0@bc/bundler/gems/browsercms-c0b85c0f36ad/app/views/cms/dynamic_views/edit.html.erb:2:in __usr_local_rvm_gems_ruby_______p__bc_bundler_gems_browsercms_c_b__c_f__ad_app_views_cms_dynamic_views_edit_html_erb__713174666_90296600' /usr/local/rvm/gems/ruby-1.9.3-p0@bc/gems/actionpack-3.1.3/lib/action_view/template.rb:171:inblock in render'
/usr/local/rvm/gems/ruby-1.9.3-p0@bc/gems/activesupport-3.1.3/lib/active_support/notifications.rb:55:in `instrument'

@victorhooi

This comment has been minimized.

Show comment
Hide comment
@victorhooi

victorhooi Mar 23, 2012

heya,

I seem to get this same error when I try to edit a template as well.

Cheers,
Victor

victorhooi commented Mar 23, 2012

heya,

I seem to get this same error when I try to edit a template as well.

Cheers,
Victor

@rubyconvict

This comment has been minimized.

Show comment
Hide comment
@rubyconvict

rubyconvict Mar 27, 2012

Confirmed, same problem here, bcms 3.4, rails 3.1.4, quick patch would be:

app/helpers/cms/path_helper.rb

module Cms

@todo All methods really need to be renamed to match conventions for Engines.

In CMS::Engine, shouldn't have cms_ in method name.

From app, should be cms.xyz_path

module PathHelper

def cms_index_path_for(resource, options={})
  #polymorphic_path(build_path_for(resource), options)
  #####
  engine_matcher = main_app.routes.named_routes[:cms].path.to_s.gsub(/^\//,'') + '\/'
  if resource.respond_to?(:gsub)
    cms_safe_path = resource.to_s.gsub(/^#{engine_matcher}/,'')
  else
    cms_safe_path = resource.name.constantize
  end
  polymorphic_path(cms_safe_path, options)
  #####
end

...

def cms_new_path_for(resource, options={})
  #new_polymorphic_path(build_path_for(resource), options)
  ####
  if resource.respond_to?(:new_record?) && resource.new_record?
    new_polymorphic_path(build_path_for(resource), options)
  else
    new_polymorphic_path(build_path_for(resource), options)
  end
  ####
end

rubyconvict commented Mar 27, 2012

Confirmed, same problem here, bcms 3.4, rails 3.1.4, quick patch would be:

app/helpers/cms/path_helper.rb

module Cms

@todo All methods really need to be renamed to match conventions for Engines.

In CMS::Engine, shouldn't have cms_ in method name.

From app, should be cms.xyz_path

module PathHelper

def cms_index_path_for(resource, options={})
  #polymorphic_path(build_path_for(resource), options)
  #####
  engine_matcher = main_app.routes.named_routes[:cms].path.to_s.gsub(/^\//,'') + '\/'
  if resource.respond_to?(:gsub)
    cms_safe_path = resource.to_s.gsub(/^#{engine_matcher}/,'')
  else
    cms_safe_path = resource.name.constantize
  end
  polymorphic_path(cms_safe_path, options)
  #####
end

...

def cms_new_path_for(resource, options={})
  #new_polymorphic_path(build_path_for(resource), options)
  ####
  if resource.respond_to?(:new_record?) && resource.new_record?
    new_polymorphic_path(build_path_for(resource), options)
  else
    new_polymorphic_path(build_path_for(resource), options)
  end
  ####
end
@ebaizel

This comment has been minimized.

Show comment
Hide comment
@ebaizel

ebaizel Apr 11, 2012

@rubyconvict thanks for the helper methods. now when i run it i get * undefined method `build_path_for' *

any suggestions on what is causing this? here is the full trace:

Message
undefined method `build_path_for' for #<#Class:0x007fcf36ddef20:0x007fcf36dea820>

Stacktrace
/Users/myMac/Documents/workspace/rails_projects/newCMS4/app/helpers/cms/path_helper.rb:27:in `cms_new_path_for'

ebaizel commented Apr 11, 2012

@rubyconvict thanks for the helper methods. now when i run it i get * undefined method `build_path_for' *

any suggestions on what is causing this? here is the full trace:

Message
undefined method `build_path_for' for #<#Class:0x007fcf36ddef20:0x007fcf36dea820>

Stacktrace
/Users/myMac/Documents/workspace/rails_projects/newCMS4/app/helpers/cms/path_helper.rb:27:in `cms_new_path_for'

@Houdini

This comment has been minimized.

Show comment
Hide comment
@Houdini

Houdini Apr 22, 2012

Same error

Houdini commented Apr 22, 2012

Same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment