title: undefined method `after_create' for Controller:Class
body: <p>I am unsure why i get the below error. I am new to rails so Any help and explanation will be much appreciated.</p>
  
  <ol>
  <li>i am trying to send emails to subscribers each time a blog is created.</li>
  <li>in my blog controller i have added <code>after_create :send_email_to_subscribers</code></li>
  <li>in my blog controller i have also added the method <code>send_email_to_subscribers</code></li>
  <li>i have put in place successfully <code>ActionMailer</code></li>
  <li>this was initially working and suddenly stopped</li>
  <li>has the after_create method been decaprecated?</li>
  <li>the error prompts up when i click &lt;%= link_to 'create new blog', new_usera_blog_path(current_usera) %></li>
  <li>i tried using <code>after_filter :send_email_to_subscribers</code> instead of <code>after_create :send_email_to_subscribers</code> in my blogs controller but that prompted up more errors in the mailer_subscribe.rb file</li>
  </ol>
  
  <p>The below is the current error i get :</p>
  
  <blockquote>
    <p>undefined method `after_create' for BlogsController:Class</p>
  </blockquote>
  
  <p>terminal shows error:</p>
  
  <pre><code>Started GET "/useras/1/blogs/2" for 127.0.0.1 at 2015-06-20 20:14:16 +0100
    ActiveRecord::SchemaMigration Load (0.2ms)  SELECT "schema_migrations".* FROM "schema_migrations"
  Processing by BlogsController#show as HTML
    Parameters: {"usera_id"=&gt;"1", "id"=&gt;"2"}
    Blog Load (0.1ms)  SELECT  "blogs".* FROM "blogs"  WHERE "blogs"."id" = ? LIMIT 1  [["id", 2]]
    Usera Load (0.1ms)  SELECT  "useras".* FROM "useras"  WHERE "useras"."id" = ? LIMIT 1  [["id", 1]]
    Blog Load (0.2ms)  SELECT  "blogs".* FROM "blogs"  WHERE "blogs"."usera_id" = ? AND "blogs"."id" = ? LIMIT 1  [["usera_id", 1], ["id", 2]]
    Rendered blogs/show.html.erb within layouts/application (3.0ms)
    Subscriber Load (0.2ms)  SELECT "subscribers".* FROM "subscribers"
  
  MailerSubscribe#subscription_email: processed outbound mail in 7.8ms
  Completed 500 Internal Server Error in 891ms (Views: 798.5ms | ActiveRecord: 1.4ms)
  
  NoMethodError - undefined method `title' for #&lt;BlogsController:0x007fae0af874f0&gt;:
    app/mailers/mailer_subscribe.rb:6:in `subscription_email'
    actionpack (4.1.10) lib/abstract_controller/base.rb:189:in `process_action'
    actionpack (4.1.10) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
    activesupport (4.1.10) lib/active_support/callbacks.rb:82:in `run_callbacks'
    actionpack (4.1.10) lib/abstract_controller/callbacks.rb:19:in `process_action'
    actionpack (4.1.10) lib/abstract_controller/base.rb:136:in `process'
  </code></pre>
  
  <p>blogs_controller.rb</p>
  
  <pre><code>class BlogsController &lt; ApplicationController
    respond_to :html, :xml, :json
    before_action :set_blog, only: [:show, :edit, :update, :destroy]
    after_create :send_email_to_subscribers
  
    def index
  ...
    end
  
    def show
  ...
    end
  
    def new
      @usera = Usera.find(params[:usera_id])
      @blog = @usera.blogs.build
      respond_with(@blog)
    end
  
    def edit
    end
  
    def create
      @usera = Usera.find(params[:usera_id])
      @blog = @usera.blogs.create(blog_params)
      respond_to do |format|
        if @blog.save
          format.html { redirect_to([@blog.usera, @blog], notice: 'Blog was successfully created.') }
          format.json  { render json: @blog, status: :created, location: @blog }
        else
          format.html { render action: "new" }
          format.json  { render json: @blog.errors, status: :unprocessable_entity }
        end
      end
    end
  
    def update
  ...
    end
  
    def destroy
  ...
    end
  
  
    private
      def set_blog
        @blog = Blog.find(params[:id])
      end
  
      def blog_params
        params.require(:blog).permit(:title, :content, :usera_id, :link, :image, :category_blog_id, :image)
      end
  
      def send_email_to_subscribers
        Subscriber.all.each do |subscriber|
          MailerSubscribe.subscription_email(subscriber.email,self)
        end
      end
  end
  </code></pre>
  
  <p>mailer_subscribe.rb</p>
  
  <pre><code>class MailerSubscribe &lt; ActionMailer::Base
    default from: "info@recruitmentafrica"
  
    def subscription_email(email,blog)    
      @blog = blog
      mail(to: email, subject: @blog.title)
    end
  end
  </code></pre>