On Sunday, 23 June 2013 20:22:26 UTC-7, Bob O wrote:
>
> This is the TransactionAttributes
>
> module TransactionAttributes
>
>   def success
>     success
>   end
>
>   def success=(success)
>     self.success = success
>   end
>

That's the problem right there - this method is calling itself. If you want 
to define a getter / setter, you should either do this:

def success
  @success
end

def success=(value)
  @success = value
end

---
Or this (preferred, if you're just storing a value, as above):

attr_accessor :success

 

>   def errors
>   errors
>   end
>
>   def errors=(errors)
>   self.errors = errors
>   end
> end
>

These will break some things - ActiveRecord already defines an `errors` 
method + `errors=` assignment operator, and expects them to behave in a 
particular way (for instance, the validations assume that you can make 
calls like `some_model.errors.add(:some_attribute, 'message')`).

I highly recommend reading through the guides 
(http://guides.rubyonrails.org/) or following some of Michael Hartl's 
excellent tutorial (http://ruby.railstutorial.org/) in preference to 
digging through Stack Overflow - the answers there are incredibly useful if 
you've got a highly specific problem, but they can sometimes miss the 
bigger picture.

Hope this helps,

--Matt Jones

-- 
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 rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/d64093f3-4bb5-4d4c-b02c-af2c1018a196%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to