Friday 15 June 2012

ruby on rails - Action Mailer to all Users not working -



ruby on rails - Action Mailer to all Users not working -

generated mailer notify users when "article created". had working, stopped...not sure happened.

here's actionmailer:

class articlemailer < actionmailer::base default from: "coach@gmail.com" # subject can set in i18n file @ config/locales/en.yml # next lookup: # # en.referral_mailer.referral_confirmation.subject # def article_confirmation(user,article) @user = user @article = article mail service to: user.email, subject: "coach #{user.first_name}, new goal has been posted" end end

the controller phone call to mailer:

class articlescontroller < applicationcontroller load_and_authorize_resource skip_authorize_resource :only => [:index, :show] def new @article = article.new end def create @article = article.new(article_params) # authorize! :create, @article if @article.save #send email referral email all_users = user.all all_users.each |user| articlemailer.article_confirmation(user,@article).deliver end redirect_to @article else render 'new' end end .....

looks it's working added application controller:

before_action resource = controller_name.singularize.to_sym method = "article_params" params[resource] &&= send(method) if respond_to?(method, true) end

now...not working on admin side rails_admin gem...

ruby-on-rails actionmailer

No comments:

Post a Comment