Merged changes from issue-52 to fix problems seen with send message #82

Closed
wants to merge 6 commits into
from

Conversation

Projects
None yet
2 participants

These changes fix problems I was seeing with using factory_girl thanks to @atd and his changes in issue-52 . I merged his changes from issue-52 and the specs passed again. I was however seeing the same problem with my app which doesn't use hydra-head and this is what I see:

in ./app/models/message.rb:
at line 52

email_to = r.send(Mailboxer.email_method,self)

it is throwing an exception from rails attribute_accesors .
However rails doesn't show the exact nature of the error. I had to use debugger to get that far.
I changed

config.uses_emails = false

and now everything runs fine. However this problem needs more robust error handling to help with sanity in the future.

Contributor

atd commented Sep 20, 2012

I merged the original branch. This pull request is quite dirty!

atd closed this Sep 20, 2012

hey @atd - sorry about not explaining this further. I basically made my fork of your project work with a rails 3.2.2 project and I essentially wanted to let you know about it. I really want to thank you for this project as its coming in very useful to me and our project over here in in California.

One thing I've noticed working with the base project is that when creating a User it fails to automatically create the Actor which the system needs. One hackish way i've dealt with this is to do the following:

in the subject.rb module I changed to this:

included do
    subtype_of :actor,
               :build => { :name => 'Subject Name', :email => 'Subject Email', :subject_type => to_s }

and then added this

           after_save :ensure_update_actor

                 def ensure_update_actor
                   raise(ActiveRecord::ActiveRecordError, "You must override the ensure_update_actor method in your class #{self.class.to_s} and ensure the name and email in the actor class are updated properly in order for your class to mixin Subject correctly.")
                end

And then in something like the user.rb class what I did was this:

def ensure_update_actor
self.actor.name = self.name
self.actor.email = self.email
self.actor.save!
end

I know this isn't the best way to do this but it got me thinking and I'm not sure what you intended for how that is supposed to work out of the box. Anyway, thanks again for your project. Look forward to using it more.

-matt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment