Reputation: 69
Doing my first rails development, modified config/ environments/ development.rb to be able to connect to an email server. When I restart rails server I get the following error message:
"...Ruby/learn-rails/config/environments/development.rb:39: syntax error, unexpected '=', expecting => (SyntaxError) ...default_url_options = { :host = > 'localhost: 3000' } ... ".
I don't see the syntax error, anyone see where i went wrong?
The code i added to the development.rb file looks like this:
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: Rails.application.secrets.domain_name,
authentication: "plain",
enable_starttls_auto: true,
user_name: Rails.application.secrets.email_provider_username,
password: Rails.application.secrets.email_provider_password
}
# ActionMailer Config
config.action_mailer.default_url_options = { :host = > 'localhost: 3000'}
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
Upvotes: 1
Views: 250
Reputation: 27747
Your problem is this line:
config.action_mailer.default_url_options = { :host = > 'localhost: 3000'}
your hashrocket has a space in it... try:
config.action_mailer.default_url_options = { :host => 'localhost: 3000'}
Also, in future, that stacktrace gives you the precise line-number that the error is on:
Ruby/learn-rails/config/environments/development.rb:39
this says that the problem is on line 39 of config/environments/development.rb
You can go to precisely that line in your text editor to look for the error it's complaining about.
Upvotes: 1