Skip to content
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

Shortcut for timestamps #418

Closed
Drenmi opened this issue Nov 22, 2016 · 8 comments
Closed

Shortcut for timestamps #418

Drenmi opened this issue Nov 22, 2016 · 8 comments

Comments

@Drenmi
Copy link

Drenmi commented Nov 22, 2016

A common and recurring thing we do is implement callbacks for updating timestamps. How about an option for state that automatically updates the timestamp when the record enters that state?

state :finished, timestamp: true
# Will look for an attribute `finished_at`

perhaps with an optional attribute name for flexibility:

state :draft, timestamp: :drafted_at

WDYT?

@anilmaurya
Copy link
Member

I liked optional attribute name flexibility.

Would like to have this feature in AASM, are you interested in sending a PR ?

@CapCap
Copy link

CapCap commented Jan 13, 2017

@anilmaurya am getting the same thing as #424

Gem::InstallError: nokogiri requires Ruby version >= 2.1.0.
Installing aws-sdk-core 2.6.44
An error occurred while installing nokogiri (1.7.0.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.7.0.1'` succeeds before bundling.

@Drenmi
Copy link
Author

Drenmi commented Jan 13, 2017

@anilmaurya: I might be able to submit a PR, once I have some spare time. 😅 If anyone comes across this and wants to work on it, feel free. 😊

@anilmaurya
Copy link
Member

@CapCap At first it look looks like nokogiri 1.7.0.1 dependency on ruby >= 2.1.0 may be the reason behind failing specs. I will debug further to solve it.
@Drenmi Looking forward for pull request 😊

@anilmaurya
Copy link
Member

@Drenmi Just came across #427 , @CapCap is working on this.

@h0jeZvgoxFepBQ2C
Copy link

Can be closed after this was merged or?

@Drenmi
Copy link
Author

Drenmi commented May 31, 2017

@lichtamberg: The relevant PR (#427) is still open. I don't think anyone is working on it though. 🙂

@kbighorse
Copy link

kbighorse commented Apr 17, 2023

Was @Drenmi's mentioned optional attribute name for flexibility ever implemented?

state :draft, timestamp: :drafted_at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants