On Tuesday, December 2, 2014 8:03:58 AM UTC, itsmechlark wrote:
>
> class LibraryFramework < ActiveRecord::Base
>
> self.abstract_class = true
>
>
> def content_with_corrector
> justified = self.class.justify_content(content_without_corrector)
> self.class.check_replace_invalid_format(justified)
> end
> alias_method_chain :content, :corrector
>
>
>
Well this class doesn't have a content method. If content is an accessor
method generated by active record for a database column of the same name
then the issue is that the abstract class has no table and this no columns.
You might be able to use the inherited hook to add this override when your
class is corrected
Also in recent versions of rails the accessor methods are generated in a
module included in the class - i don't thing you need to use
alias_method_chain anymore - normal inheritance will do the job, so you
might be able to get away with just
def content
justified = self.class.justify_content(super)
self.class.check_replace_invalid_format(justified)
end
Even if you're not on the right rails version, you can use read_attribute
instead of calling super.
Fred
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/5485ca48-a7ea-4ef6-bed5-d75641b8d25a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.