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

Needed to replace inspect() and find() - neither worked correctly for me #16

Open
JohnB opened this issue Jun 16, 2015 · 1 comment
Open

Comments

@JohnB
Copy link

JohnB commented Jun 16, 2015

I don't know if this is the underlying issue for #7 , but I've found that when I fetch an object the display from inspect() does not show the ID field - but direct access via obj.id shows it just fine. Thus I over-wrote inspect() for my redshift models to correctly show the ID:

  def inspect
    details = attributes.keys.map {|k| "#{k}: #{(k == 'id' ? self.id : self[k]).inspect}" }.join(", ")
    return "#<#{self.class.name} #{details}>"
  end

Also, the find() method was throwing an exception for me so I patched it to call find_by_id():

    def self.find(integer_id)
      find_by_id(integer_id)
    end

Has anyone else noticed these issues? If so, I'll try to put a better fix into place and do a PR.

@alexperto
Copy link

regarding the find method, I think that's the expected behavior http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-find

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

2 participants