Skip to content

Instantly share code, notes, and snippets.

@jcutrell
Last active August 29, 2015 14:19
Show Gist options
  • Save jcutrell/22a1da1ca068322ffb86 to your computer and use it in GitHub Desktop.
Save jcutrell/22a1da1ca068322ffb86 to your computer and use it in GitHub Desktop.
Weird behavior...
class BaseJob < ActiveRecord::Base
belongs_to :child_job, polymorphic: true
has_attached_file :header_image, :styles => { :medium => "800x500#" }
validates_attachment_content_type :header_image, :content_type => /\Aimage\/.*\Z/
validates :title, presence: true
validates :prompt_html, presence: true
end
class Redirector < ActiveRecord::Base
has_many :redirector_clicks
has_one :link_job
end
@jcutrell
Copy link
Author

(The thing that led me to this was the fact that the form submission caused what looked like a duplicate record, but in fact was due to the form having the new link_jobs path set on it, then I tracked it down to the persisted method by looking at the form_for helper itself to determine which path it drops into resource forms.)

@jcutrell
Copy link
Author

As it turns out, the include BaseJobMethods line referenced a module that included ActiveRecord::Base. Removing that inclusion fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment