Coder Social home page Coder Social logo

Comments (8)

imunteanu avatar imunteanu commented on June 22, 2024 1

Sorry for my late response.
It might have been that the documentation of saved_change_to_attribute? was not clear. I would guess that in our case we were evaluating if an attribute was updated, but there was not any save method called yet. (in Rails 5.1+?)

I have changed with will_save_change_to_attribute - post.rb - and it seems to be working fine:
will_save_change_to_attribute?(:custom_url) || will_save_change_to_attribute?(:title)

Couldn't run tests and didn't had time to figure out how can setup al refinerycms in dev mode. If you have some documentation about what do I need setup in a dev env, I will be happy to contribute.

Best
Ionut

from refinerycms-blog.

parndt avatar parndt commented on June 22, 2024

I found some documentation around this: http://blog.toshima.ru/2017/04/06/saved-change-to-attribute.html which says that attribute_changed? is deprecated and that saved_change_to_attribute? is the new version.

We updated this in #480 as this version of Refinery specifically targets Rails 5.1.x

I wonder what could be going wrong?

from refinerycms-blog.

parndt avatar parndt commented on June 22, 2024

Hi Ionut, thank you! Does this guide help you? https://www.refinerycms.com/guides/contributing-to-refinery

from refinerycms-blog.

imunteanu avatar imunteanu commented on June 22, 2024

Yes, I should have seen it :)

I'll make a PR on this issue after I will have the dev + test mode running.

Best
Ionut

from refinerycms-blog.

spotlessicode avatar spotlessicode commented on June 22, 2024

Hi, this little change solved friendly URL me too.

saved_change_to_attribute?(:custom_url) || saved_change_to_attribute?(:title)

to

will_save_change_to_attribute?(:custom_url) || will_save_change_to_attribute?(:title)

from refinerycms-blog.

bricesanchez avatar bricesanchez commented on June 22, 2024

Hi @spotlessicode, could you provide a pull request with a test?

from refinerycms-blog.

spotlessicode avatar spotlessicode commented on June 22, 2024

Hi @bricesanchez I tried, but after several hours, I couldn't set forked and cloned refinerycms-blog in local.
screen shot 2018-07-09 at 17 08 08
screen shot 2018-07-09 at 17 07 01

from refinerycms-blog.

spotlessicode avatar spotlessicode commented on June 22, 2024

It doesn' work if you change something in the post, but not the title, it just goes back to the blog/post/1 url instead of the friendly one. So you have to add a space or something at the and of the title if you edit a post and save with that title changes. so better to use body as well:

will_save_change_to_attribute?(:custom_url) || will_save_change_to_attribute?(:title) || will_save_change_to_attribute?(:body)

from refinerycms-blog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.