theodorton / yard-activerecord

Plugin for YARD to document ActiveRecord stuff
MIT License
45 stars 28 forks source link

Exception when using active_interaction #20

Closed Hampei closed 8 years ago

Hampei commented 10 years ago

I'm getting a whole bunch of exceptions in the output from active_interaction classes, since this plugin is trying to parse the files that are ActiveModelable. Can I specify files to be excluded/included for this plugin?

[error]: Unhandled exception in YARD::Handlers::Ruby::ActiveRecord::Fields::FieldHandler:
[error]:   in `app/use_cases/create_dossier_group.rb`:4:

  4: string :name

[error]: NoMethodError: undefined method `jump' for nil:NilClass
[error]: Stack trace:
  /Users/henk/.rvm/gems/ruby-2.1.0/gems/yard-activerecord-0.0.11/lib/yard-activerecord/fields/field_handler.rb:13:in `process'
  /Users/henk/.rvm/gems/ruby-2.1.0/gems/yard-0.8.7.4/lib/yard/handlers/processor.rb:114:in `block (2 levels) in process'
  /Users/henk/.rvm/gems/ruby-2.1.0/gems/yard-0.8.7.4/lib/yard/handlers/processor.rb:112:in `each'
  /Users/henk/.rvm/gems/ruby-2.1.0/gems/yard-0.8.7.4/lib/yard/handlers/processor.rb:112:in `block in process'
  /Users/henk/.rvm/gems/ruby-2.1.0/gems/yard-0.8.7.4/lib/yard/handlers/processor.rb:111:in `each'
  /Users/henk/.rvm/gems/ruby-2.1.0/gems/yard-0.8.7.4/lib/yard/handlers/processor.rb:111:in `each_with_index'

active_interaction classes look like:

class CreateDossier < ActiveInteraction::Base
  string :firstname
  date :birthdate
  integer :foo
  ...
end
mherold commented 9 years ago

+1

Same problems here when you have a simple ruby object with e.g. a date method getting called:

class Foo
  def initialize
    date 'foo', 'bar'
  end

  def date(a, b)
    ...
  end
end

... would get you Unhandled exception in YARD::Handlers::Ruby::ActiveRecord::Fields::FieldHandler: in 'app/models/foo.rb':3:

theodorton commented 9 years ago

Could you try installing the plugin from the field-handler-issue branch?

# Gemfile
...
gem 'yard-activerecord', github: 'theodorton/yard-activerecord', branch: 'field-handler-issue'
mherold commented 9 years ago

Works like a charm for me, thanks! ;-)

mherold commented 8 years ago

Anything preventing the merge of #26 into master? If yes, can I help in any way?

theodorton commented 8 years ago

@mherold I'm merging this and pushing to Rubygems later today. I'll let you know.

theodorton commented 8 years ago

@mherold merged, tagged as 0.0.16 and pushed to rubygems. sorry for the wait

mherold commented 8 years ago

@theodorton great, thanks! :heart: