这是indexloc提供的服务,不要输入任何密码
Skip to content

Friendly urls are not generated on save #485

@imunteanu

Description

@imunteanu

Hi,

It seems that post's slug is not generated when save/update.

I'm using
gem 'refinerycms', '~> 4.0'
gem 'refinerycms-blog', git: 'https://github.com/refinery/refinerycms-blog', branch: 'master'

It might be that this one returns always false:

  # If custom_url or title changes tell friendly_id to regenerate slug when
  # saving record
  def should_generate_new_friendly_id?
    saved_change_to_attribute?(:custom_url) || saved_change_to_attribute?(:title)
  end

I had forced this method to always return false and the slug/friendly_id is generated. So it might be that those attributes are not seen as saved.

I have changed to
attribute_changed?(:custom_url) || attribute_changed?(:title)

and it returns correctly the state of attribute changes. I wonder if is not a Rails 5.1 issue?

thank you
Ionut

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions