0

This is my Model (Subscription) Method:

  def activation_codes(options = {})
    if options[:first]
      self.group.group_codes.first
    else
      self.group.group_codes
    end
  end

I am trying to call to this method in this fashion:

sub = Subscription.where(:subscription_limit => -1).first
sub.activation_codes {:first}

For some reason the elseis being evaluated.

1 Answer 1

1

You need to pass Hash to method activation_codes in order to make it work as expected, like:

sub.activation_codes({:first => 'some value'})

but you're currently passing Symbol instead.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the help! That was what I was missing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.