werein / x-editable-rails

Edit fields easily with X-Editable helper
https://wereinhq.com/guides/x-editable-rails
MIT License
155 stars 87 forks source link

undefined method `xeditable?' error shows up #90

Open ghost opened 7 years ago

ghost commented 7 years ago

I included this in _coment.html.erb

<%= editable [comment.article, comment], :content, url: edit_article_comment_path(comment.article, comment) %>

I also included a helper method below, which is included (helper_method :xeditable?) in the application controller. I don't use cancan authentication.

module ApplicationHelper

def xeditable?
  can?(:edit, object) ? true : false
end

  def can?(role, object)
     true 
  end
end
Br3nda commented 5 years ago

One edit:

  def xeditable?(object)
    can?(:edit, object) ? true : false
  end