footnote_attrs :title, :body is a method invocation. If you want to call the method in your class like this:
class Foo
footnote_attrs :title, :body
end
You have to define the method accordingly:
class Foo
def self.footnote_attrs(*args)
@footnote_attrs = args unless args.empty?
@footnote_attrs
end
# if footnote_attrs is to be accessed like an instance method
def footnote_attrs
self.class.footnote_attrs
end
footnote_attrs :title, :body
end
Foo.footnote_attrs #=> [:title, :body]
footnote_attrs #=> [:title, :body]
The implementation is very basic. If the method is called with arguments, it sets the instance variable accordingly. If it is called without arguments, it just returns it.
You might want to return an empty array if footnote_attrs has not been called yet (currently it would return nil). It might also be a good idea to return a copy (dup) instead of the actual array to prevent modification.
footnote_attrsagain with different arguments?