开发者

Permalink-fu plugin not working for me in Rails 3

开发者 https://www.devze.com 2023-02-26 05:54 出处:网络
I\'m using Rails 3 and I\'ve downloaded the permalink-fu plugin (I\'ve installed and 开发者_开发技巧used it in Rails 2.3.8 several times without any issues), but when I go either to the New or Show vi

I'm using Rails 3 and I've downloaded the permalink-fu plugin (I've installed and 开发者_开发技巧used it in Rails 2.3.8 several times without any issues), but when I go either to the New or Show view of my model (it's called List), I get the following error:

undefined method `evaluate_attribute_method' for #<Class:0xb57ede88>

This doesn't happen if I remove the has_permalink :title line from my List model, but I need it in order for the plugin to work.

My model looks like this:

class List < ActiveRecord::Base
  has_permalink :title

  def to_param
    permalink
  end
end

My controller looks like this:

  def show
    @list = List.find_by_title(params[:permalink])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @list }
    end
  end

  # GET /lists/new
  # GET /lists/new.xml
  def new
    @list = List.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @list }
    end
  end

My routes file looks like this:

match '/:permalink' => 'lists#show', :as => :list

Could anybody tell me what's wrong?


I've made this work by installing the permalink_fu gem instead of the plugin.


Put into into your gemfile

gem "permalink_fu", "~> 1.0.0"

then

bundle install
0

精彩评论

暂无评论...
验证码 换一张
取 消