Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot define multiple 'included' blocks for a Concern #188

Closed
andriytyurnikov opened this issue May 27, 2014 · 5 comments
Closed

Cannot define multiple 'included' blocks for a Concern #188

andriytyurnikov opened this issue May 27, 2014 · 5 comments
Assignees
Labels
Milestone

Comments

@andriytyurnikov
Copy link

Got error message:
Unable to annotate magaz_core/concerns/shopping_cart.rb: Cannot define multiple 'included' blocks for a Concern

Code of that concern:

module MagazCore
  module Concerns
    module ShoppingCart
      extend ActiveSupport::Concern

      included do
        delegate :each, :empty?, to: :line_items
      end

      def items
        line_items
      end

    end
  end
end

looks like namespaces confuse annotate_models

@andriytyurnikov
Copy link
Author

It is edge rails, btw

@mgenereu
Copy link

👍

@felipero
Copy link

felipero commented Jun 2, 2014

I have the same issue without using nested namespaces.

module DateBoundable
    extend ActiveSupport::Concern

    # since rails doesn't read the ruby date parsing format from a locale file...
    # see http://stackoverflow.com/questions/5372464/ruby-1-87-vs-1-92-date-parse/5373165#5373165
    included do
        attr_accessor :end_date_string, :start_date_string
        alias_attribute :due_date_string, :end_date_string
        before_validation :parse_dates
    end

    def formatted_start_date
        unless start_date.nil?
            start_date.strftime(I18n.t('time.formats.default'))
        end
    end
end

@cyrusstoller
Copy link

+1

@ctran ctran added the bug label Jun 14, 2014
@ctran ctran added this to the v2.6.4 milestone Jun 14, 2014
@ctran ctran self-assigned this Jun 14, 2014
@ctran
Copy link
Owner

ctran commented Jun 15, 2014

This is addressed by #194.

@ctran ctran closed this as completed Jun 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants