Skip to content
This repository has been archived by the owner on Feb 9, 2019. It is now read-only.

class and include_predecessor_id paramters added #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

davidkovaccs
Copy link

Hi!

I've added a :class => "::Namespace::ClassName" parameter to acts_as_heir_of to be able to inherit classes from other namespace. This also fixes a bug when the predecessor class name was camelized (like: ActivityItem).

And I've added a :include_predecessor_id => true parameter what adds {predecessor_name}_id as an attribute to the child class.

Regards, David

extend ClassMethods
include InstanceMethods

class_attribute :_predecessor_klass, :_predecessor_symbol
self._predecessor_symbol = predecessor_symbol
self._predecessor_klass = Object.const_get(predecessor_symbol.to_s.capitalize)
if defined? params and not params.nil? and defined? params[:class] and not params[:class].nil? then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I read it, you are asking two things: (A) Is the params hash present, and (B) Is the params[:class] present. So why not simply ask params[:class].present?

@dipth
Copy link
Owner

dipth commented Jul 22, 2013

Please try to address the concerns that @ekampp pointed out

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

Successfully merging this pull request may close these issues.

3 participants