Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7809773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:32:33+00:00 2026-06-02T03:32:33+00:00

I’m very new to ruby and rails (3 days and counting), so my problem

  • 0

I’m very new to ruby and rails (3 days and counting), so my problem is probably something stupid. However, it seems to be something stupid that couldn’t be resolved by searching for answers online. 🙁

I’m creating a simple blog app following this guide: http://guides.rubyonrails.org/getting_started.html. It works fine, no issues.

Then I set up SendGrid and I’m able to send emails through it just fine as well.

Now, I’m trying to use this sendgrid gem: https://github.com/stephenb/sendgrid. I installed it using ‘gem install sendgrid’ and it seemed to work without problems.

According to the instructions on github, I just need to add “include SendGrid” in my mailer class and I’m good to go. I did just that:

class Emailer < ActionMailer::Base
    include SendGrid
    ...
end

But when I run the app, I get this error: uninitialized constant Emailer::SendGrid

I did a couple of other things that seemed to make sense based on what I’ve read so far:

  • Added ‘gem sendgrid’ in my Gemfile. This added three lines to my Gemfile.lock:
    • sendgrid (1.0.1)
    • json
    • json
  • Added ‘require sendgrid’ in my environment.rb file.

Yet, the error still persists. One thing that might be indicative of a problem is that when I look at the $LOAD_PATH, it doesn’t have the sendgrid directory. For comparison, another gem included in the same manner is sqlite3 and I see the “…/sqlite3-1.3.4/lib” path there, but I don’t see “…/sendgrid-1.0.1/lib”.

Can somebody discern what kind of stupidity has afflicted me this time?

EDIT:

I discovered something very interesting. For me at least… If I go into the rails console, things actually seem to work fine. Here is the output of my session:

ruby-1.9.2-p290 :006 > include SendGrid
 => Object 
ruby-1.9.2-p290 :007 > sendgrid_category :use_subject_lines
 => :use_subject_lines 
ruby-1.9.2-p290 :008 > sendgrid_category "Welcome"
 => "Welcome" 
ruby-1.9.2-p290 :009 > p = Post.new(:title => "A new post", :content => "With garbage text")
 => #<Post id: nil, name: nil, title: "A new post", content: "With garbage text", created_at: nil, updated_at: nil> 
ruby-1.9.2-p290 :010 > Emailer.send_email("nick@sidebark.com", p).deliver
 => #<Mail::Message:2194904560, Multipart: false, Headers: <Date: Thu, 22 Sep 2011 16:52:41 -0700>, <From: ... blah, bah, blah...>>

The email got sent AND the category got registered by SendGrid (I could see it on the Statistics page).

So, the big question is: Why is it that my app only allows me to include SendGrid when I’m running commands form the console? What’s the difference in environment, etc.?

Also note that the emails get sent form the console, but NOT from the app flow, even though the development.log says that an email was sent in both situations…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:32:34+00:00Added an answer on June 2, 2026 at 3:32 am

    For anyone who didn’t read the comments on the original post, the answer is that the server needs to be restarted once you make changes to the dependencies or the configuration of your app.

    As far as the reason things were working in the console, every time you load up a Rails console, you’re reloading your entire app including the new dependencies and config files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build
I am currently running into a problem where an element is coming back from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.