Giter Club home page Giter Club logo

Comments (8)

ScotterC avatar ScotterC commented on June 9, 2024

hmm. I bet there's a way to do this simply. I haven't explored much into changing the primary key of a table. Is there a rails model method that gives the primary key column name?

from delayed_paperclip.

 avatar commented on June 9, 2024

Actually i was looking around and i think that replacing

self.class.where(:id => self.id).update_all(updates)

with

self.class.where(self.primary_key => self.id).update_all(updates)

will allow the correct primary_key to be loaded. As far as i can see this works in my development app.

from delayed_paperclip.

ScotterC avatar ScotterC commented on June 9, 2024

That sounds perfect. Mind submitting a pull request?

On Sunday, August 18, 2013, Cristian Rivera wrote:

Actually i was looking around and i think that replacing

self.class.where(:id => self.id).update_all(updates)

with

self.class.where(self.primary_key => self.id).update_all(updates)

will allow the correct primary_key to be loaded. As far as i can see this
works in my development app.


Reply to this email directly or view it on GitHubhttps://github.com//issues/51#issuecomment-22824553
.

Sent from Mobile

from delayed_paperclip.

 avatar commented on June 9, 2024

Yea I will definitely make a pull request but after more testing I realized
that using self.primary_key isn't reliable. I'm trying to add an option
that the user can pass an option stating the primary key.

Sent from my iPhone

On Aug 18, 2013, at 4:20 PM, Scott Carleton [email protected]
wrote:

That sounds perfect. Mind submitting a pull request?

On Sunday, August 18, 2013, Cristian Rivera wrote:

Actually i was looking around and i think that replacing

self.class.where(:id => self.id).update_all(updates)

with

self.class.where(self.primary_key => self.id).update_all(updates)

will allow the correct primary_key to be loaded. As far as i can see this
works in my development app.


Reply to this email directly or view it on GitHub<
https://github.com/jrgifford/delayed_paperclip/issues/51#issuecomment-22824553>

.

Sent from Mobile


Reply to this email directly or view it on
GitHubhttps://github.com//issues/51#issuecomment-22838324
.

from delayed_paperclip.

ScotterC avatar ScotterC commented on June 9, 2024

What's not reliable about it?

On Sunday, August 18, 2013, Cristian Rivera wrote:

Yea I will definitely make a pull request but after more testing I
realized
that using self.primary_key isn't reliable. I'm trying to add an option
that the user can pass an option stating the primary key.

Sent from my iPhone

On Aug 18, 2013, at 4:20 PM, Scott Carleton <[email protected]<javascript:_e({}, 'cvml', '[email protected]');>>

wrote:

That sounds perfect. Mind submitting a pull request?

On Sunday, August 18, 2013, Cristian Rivera wrote:

Actually i was looking around and i think that replacing

self.class.where(:id => self.id).update_all(updates)

with

self.class.where(self.primary_key => self.id).update_all(updates)

will allow the correct primary_key to be loaded. As far as i can see
this
works in my development app.


Reply to this email directly or view it on GitHub<

https://github.com/jrgifford/delayed_paperclip/issues/51#issuecomment-22824553>

.

Sent from Mobile


Reply to this email directly or view it on
GitHub<
https://github.com/jrgifford/delayed_paperclip/issues/51#issuecomment-22838324>

.


Reply to this email directly or view it on GitHubhttps://github.com//issues/51#issuecomment-22839220
.

Sent from Mobile

from delayed_paperclip.

 avatar commented on June 9, 2024

It's only available within the actual model to set the primary key and not
outside of it.

from delayed_paperclip.

ScotterC avatar ScotterC commented on June 9, 2024

I'm sure we could make that work. On calling process_in_background, that's called within the actual model so you could add the primary key there to the delayed defintions. I believe that we could even avoid adding it to the options set because #mark_enqueue_delayed_processing should also be defined with in the model it's updating.

from delayed_paperclip.

 avatar commented on June 9, 2024

After a few more tests inserting self.primary_key isn't working, i think that i thought it worked because i had some other code inserted that i was testing as an alternative. I think that we might have to add this as an option. Also looking though the ActiveRecord API self.primary_key can only be used to set the primary_key.

from delayed_paperclip.

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.