I'm using Mailgun HTTP API to send emails from rails application.But I'm not able to render the mailer views. This is my mailer class.
class MailgunMails < ActionMailer::Base
def send_complex_message
data = Multimap.new
data[:from] = "Excited User <postmasters##{##domain}>"
data[:to] = "alice#example.com"
data[:subject] = "Hello"
data[:html] = File.open("#{Rails.root}/app/views/mailgun_mails/send_complex_message.html.erb", 'r').to_s.html_safe
## also tried
data[:html] = render(template: "send_complex_message.html.erb")
response = RestClient.post "https://api:#{##private_key}"\
"#api.mailgun.net/v2/#{##domain}/messages", data
response = JSON.parse(response)
end
end
But that throws:
NoMethodError: undefined method `each_byte' for nil:NilClass
How do I use mailer views with Mailgun API.
PS: I know there are many gems available to use mailgun with rails but none of them gives full functionality as the API does.
IF there is any alternative way to send emails from the api using the rails views, I'm waiting for that answer. I just don't know how to do that (even if it doesn't use actionmailer)
FULL error trace
NoMethodError: undefined method `each_byte' for nil:NilClass
from /Users/example/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/uri/common.rb:307:in `block in escape'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.0.4/lib/active_support/core_ext/string/output_safety.rb:177:in `gsub'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.0.4/lib/active_support/core_ext/string/output_safety.rb:177:in `gsub'
from /Users/example/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/uri/common.rb:304:in `escape'
from /Users/example/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/uri/common.rb:623:in `escape'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/rest-client-1.6.7/lib/restclient/payload.rb:150:in `handle_key'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/rest-client-1.6.7/lib/restclient/payload.rb:143:in `block in build_stream'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/rest-client-1.6.7/lib/restclient/payload.rb:142:in `collect'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/rest-client-1.6.7/lib/restclient/payload.rb:142:in `build_stream'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/rest-client-1.6.7/lib/restclient/payload.rb:53:in `initialize'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/rest-client-1.6.7/lib/restclient/payload.rb:18:in `new'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/rest-client-1.6.7/lib/restclient/payload.rb:18:in `generate'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/rest-client-1.6.7/lib/restclient/request.rb:45:in `initialize'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `new'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/rest-client-1.6.7/lib/restclient.rb:72:in `post'
... 2 levels...
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/actionpack-4.0.4/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.0.4/lib/active_support/callbacks.rb:373:in `_run__1281843520849433682__process_action__callbacks'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.0.4/lib/active_support/callbacks.rb:80:in `run_callbacks'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/actionpack-4.0.4/lib/abstract_controller/callbacks.rb:17:in `process_action'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/actionpack-4.0.4/lib/abstract_controller/base.rb:136:in `process'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/actionpack-4.0.4/lib/abstract_controller/rendering.rb:44:in `process'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/actionmailer-4.0.4/lib/action_mailer/base.rb:503:in `process'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/actionmailer-4.0.4/lib/action_mailer/base.rb:497:in `initialize'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/actionmailer-4.0.4/lib/action_mailer/base.rb:480:in `new'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/actionmailer-4.0.4/lib/action_mailer/base.rb:480:in `method_missing'
from (irb):1
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.4/lib/rails/commands/console.rb:90:in `start'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.4/lib/rails/commands/console.rb:9:in `start'
from /Users/example/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.4/lib/rails/commands.rb:62:in `<top (required)>'
from bin/rails:4:in `require'
How about using the render_to_string method? I believe you want to dynamically generate the view content. Reading up the view template by opening up the file would not run any Ruby code in it.
class MailgunMails < ActionMailer::Base
def send_complex_message
data = Multimap.new
data[:from] = "Excited User <postmasters##{##domain}>"
data[:to] = "alice#example.com"
data[:subject] = "Hello"
html_output = render_to_string template: "mailgun_mails/send_complex_message"
data[:html] = html_output.to_str
response = RestClient.post "https://api:#{##private_key}"\
"#api.mailgun.net/v2/#{##domain}/messages", data
response = JSON.parse(response)
end
end
Related
I am working on Ruby on Rails application which requires to access an External API via GET requests. The request needs to send some parameters with request. I have used Activeresource gem for accessing API. The API request is working fine in Postman and giving expected records but gives me a 400 error from Rails application.
Following is the code
class PayRunEmploymentHeroBase < ActiveResource::Base
self.site = "https://api.yourpayroll.com.au"
self.user = ENV['EMPLOYMENT_HERO_USERNAME']
self.element_name = ""
self.include_format_in_path = false
self.prefix = "/api/v2/business/:business_id/payrun?$filter=DateFinalised gt datetime':finalised_date'"
end
I am pasting here the details of 400 error while accessing the link from Rails app.
Reloading...
=> true
2.3.0 :006 > PayRunEmploymentHeroBase.find(:all, params: {:business_id => business_id, :finalised_date => finalised_date})
##############################################INFO##############################################
{
"method": "get",
"request_uri": "https://api.yourpayroll.com.au:443/api/v2/business/48058/payrun?$filter=DateFinalised gt datetime'2017-11-16'",
"http_status": "400",
"http_message": "Bad Request"
}
##############################################INFO##############################################
ActiveResource::BadRequest: Failed. Response code = 400. Response message = Bad Request.
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/activeresource-5.1.0/lib/active_resource/connection.rb:141:in `handle_response'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/activeresource-5.1.0/lib/active_resource/connection.rb:126:in `request'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/activeresource-5.1.0/lib/active_resource/connection.rb:85:in `block in get'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/activeresource-5.1.0/lib/active_resource/connection.rb:220:in `with_auth'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/activeresource-5.1.0/lib/active_resource/connection.rb:85:in `get'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/activeresource-5.1.0/lib/active_resource/base.rb:1073:in `find_every'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/activeresource-5.1.0/lib/active_resource/base.rb:974:in `find'
from (irb):6
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/railties-5.0.3/lib/rails/commands/console.rb:65:in `start'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/railties-5.0.3/lib/rails/commands/console_helper.rb:9:in `start'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/railties-5.0.3/lib/rails/commands/commands_tasks.rb:78:in `console'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/railties-5.0.3/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/railties-5.0.3/lib/rails/commands.rb:18:in `<main>'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `block in require'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `require'
from /Users/bebble1/work/awe/bin/rails:9:in `<main>'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/bebble1/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:287:in `load'
from /Users/bebble1/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/bebble1/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in `require'
I have also attached a picture here of the outcome from Rails app
It seems like you are not authenticating with Rails app. And I am sure you have set authentication username/password in Postman.
Set self.password = "password" (use your own password) to PayRunEmploymentHeroBase and it will work.
Update:
It's actually your url is not encoded, do this and it will solve the issue:
self.prefix = "/api/v2/business/:business_id/payrun?$filter=" + URI::encode("DateFinalised gt datetime':finalised_date'")
I want to use Mailjet in order to send order confirmation email.
First of all, I installed Gem and configure as Mailjet guide
gem 'mailjet'
initializers/mailjet.rb
Mailjet.configure do |config|
config.api_key = '<my_api_key>'
config.secret_key = '<my_secret_key>'
config.default_from = '<my_email>'
end
config/application.rb
config.action_mailer.delivery_method = :mailjet_api
And this is action in my controller
def send_email_reserved
email = { :from_email => "<my_from_email>",
:from_name => "Dona Sky",
:subject => "Hello",
:text_part => "Hi",
:recipients => [{:email => "<my_to_email>"}] }
test = Mailjet::Send.create(email)
p test.attributes['Sent']
end
When I called the action, it showed the error
NoMethodError: undefined method `[]' for #<Set: {#<MIME::Type: application/json>}>
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/rest-client-1.6.7/lib/restclient/request.rb:307:in `type_for_extension'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/rest-client-1.6.7/lib/restclient/request.rb:312:in `type_for_extension'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/rest-client-1.6.7/lib/restclient/request.rb:286:in `block (2 levels) in stringify_headers'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/rest-client-1.6.7/lib/restclient/request.rb:286:in `map'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/rest-client-1.6.7/lib/restclient/request.rb:286:in `block in stringify_headers'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/rest-client-1.6.7/lib/restclient/request.rb:272:in `each'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/rest-client-1.6.7/lib/restclient/request.rb:272:in `inject'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/rest-client-1.6.7/lib/restclient/request.rb:272:in `stringify_headers'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/rest-client-1.6.7/lib/restclient/request.rb:92:in `make_headers'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/rest-client-1.6.7/lib/restclient/request.rb:58:in `initialize'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `new'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/rest-client-1.6.7/lib/restclient/resource.rb:67:in `post'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/mailjet-1.3.8/lib/mailjet/connection.rb:67:in `handle_api_call'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/mailjet-1.3.8/lib/mailjet/connection.rb:47:in `post'
from /Users/Dona/.rvm/gems/ruby-2.2.2/gems/mailjet-1.3.8/lib/mailjet/resource.rb:215:in `save'
This is a dependency issue. Try adding this : gem rest-client '~>1.6.9' to your Gemfile and run bundle update
I am trying to call my custom api which uploades file using paperclip , its working fine on local using https://github.com/jwagener/httmultiparty , but when I try to call the api and upload file for heroku deployed app, following errors occurs.
NoMethodError: undefined method `bytesize' for #<Array:0x00000006e71980>
from /home/umair/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:1735:in `send_request_with_body'
from /home/umair/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:1724:in `exec'
from /home/umair/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:1189:in `transport_request'
from /home/umair/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:1177:in `request'
from /home/umair/.rvm/gems/ruby-1.9.2-p320#gm/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
from /home/umair/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:1170:in `block in request'
from /home/umair/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:627:in `start'
from /home/umair/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/http.rb:1168:in `request'
from /home/umair/.rvm/gems/ruby-1.9.2-p320#gm/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
from /home/umair/.rvm/gems/ruby-1.9.2-p320#gm/gems/httparty-0.8.3/lib/httparty/request.rb:76:in `perform'
from /home/umair/.rvm/gems/ruby-1.9.2-p320#gm/gems/httparty-0.8.3/lib/httparty/request.rb:208:in `handle_response'
from /home/umair/.rvm/gems/ruby-1.9.2-p320#gm/gems/httparty-0.8.3/lib/httparty/request.rb:90:in `perform'
from /home/umair/.rvm/gems/ruby-1.9.2-p320#gm/gems/httparty-0.8.3/lib/httparty.rb:400:in `perform_request'
from /home/umair/Projects/core/lib/httmultiparty.rb:81:in `post'
from (irb):5
from /home/umair/.rvm/gems/ruby-1.9.2-p320#gm/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in `start'
from /home/umair/.rvm/gems/ruby-1.9.2-p320#gm/gems/railties-3.0.7/lib/rails/commands/console.rb:8:in `start'
from /home/umair/.rvm/gems/ruby-1.9.2-p320#gm/gems/railties-3.0.7/lib/rails/commands.rb:23:in `<top (required)>'
I am running this on ruby console to test the file upload api.
HttpClient.post('/storage.xml',:basic_auth=> {:username=>'badde88248834bec759d94563f102d52e19702fa',:password=>'b890b48e2769192372bf531fc46827cd86bea23f'} ,:query => {:auth_token=> '1045aa26cda23f5f3aec737a45e7ba0017c1a7cf',:user_file => File.new( '/home/umair/Login.png')})
I ran into the same problem and couldn't find a solution. Now I'm doing this, it only requires the multipart-post gem.
class Client
require 'net/http/post/multipart'
def self.perform inputurl, file
url = URI.parse(inputurl)
File.open(file) do |transfile|
Net::HTTP.start(url.host, url.port) do |http|
req = Net::HTTP::Post::Multipart.new(
url.path,
file1: UploadIO.new(transfile, "multipart/formdata", File.basename(file)),
)
response = http.request(req)
end
end
end
end
I'm trying to use the twitter gem in a rails 3 app but keep getting the following error:
TypeError: can't convert Pathname into String
Here's the code I'm trying to run:
class Tweet < ActiveRecord::Base
def self.test_tweet
Twitter.user_timeline("sferik").first.text
end
end
Here's the full error message:
TypeError: can't convert Pathname into String
from /home/shane/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:658:in `initialize'
from /home/shane/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:658:in `new'
from /home/shane/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:658:in `connect'
from /home/shane/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:637:in `do_start'
from /home/shane/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:626:in `start'
from /home/shane/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:1168:in `request'
from /home/shane/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:888:in `get'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/faraday-0.7.6/lib/faraday/adapter/net_http.rb:59:in `call'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/faraday-0.7.6/lib/faraday/response.rb:8:in `call'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/faraday-0.7.6/lib/faraday/response.rb:8:in `call'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/faraday-0.7.6/lib/faraday/response.rb:8:in `call'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/faraday-0.7.6/lib/faraday/request/url_encoded.rb:14:in `call'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/faraday-0.7.6/lib/faraday/request/multipart.rb:13:in `call'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/twitter-2.1.1/lib/twitter/request/multipart_with_file.rb:17:in `call'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/twitter-2.1.1/lib/twitter/request/phoenix.rb:13:in `call'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/faraday-0.7.6/lib/faraday/connection.rb:210:in `run_request'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/twitter-2.1.1/lib/twitter/request.rb:23:in `request'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/twitter-2.1.1/lib/twitter/request.rb:11:in `get'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/twitter-2.1.1/lib/twitter/client/timelines.rb:208:in `user_timeline'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/twitter-2.1.1/lib/twitter.rb:17:in `method_missing'
from /home/shane/projects/bv_data/app/models/tweet.rb:5:in `test_tweet'
from (irb):1
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/railties-3.1.2/lib/rails/commands/console.rb:45:in `start'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/railties-3.1.2/lib/rails/commands/console.rb:8:in `start'
from /home/shane/.rvm/gems/ruby-1.9.2-p290#rails312/gems/railties-3.1.2/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I get this error even when running the same code from the console:
Twitter.user_timeline("sferik").first.text
I created a blank test app with the same version of rails and the twitter gem and it runs no problem so I'm not sure what the problem is.
As I had this working before in the app I went back through my commits until I could find a point were it was working and what I did to break it.
So in case anyone happens to be in the same position what I had added was a fix_ssl.rb file in config/initializers which was to address a previous SSL connection issue. Removing this file allowed the Twitter gem to work correctly again.
config/initializers/fix_ssl.rb
require 'open-uri'
require 'net/https'
module Net
class HTTP
alias_method :original_use_ssl=, :use_ssl=
def use_ssl=(flag)
self.ca_file = Rails.root.join('lib/ca-bundle.crt')
self.verify_mode = OpenSSL::SSL::VERIFY_PEER
self.original_use_ssl = flag
end
end
end
Strange error in diagnostics.erb file about _set_controller_content_type.
Please help.
NoMethodError in Timelines#public_timeline
Showing /opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/templates/rescues/diagnostics.erb where line # raised:
undefined method `content_type' for nil:NilClass
Extracted source (around line #):
RAILS_ROOT: /Volumes/DATA/Source/Rails/tvider
Application Trace | Framework Trace | Full Trace
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/whiny_nil.rb:52:in `method_missing'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_view/base.rb:331:in `_set_controller_content_type'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_view/renderable.rb:32:in `block in render'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_view/base.rb:306:in `with_template'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_view/renderable.rb:30:in `render'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_view/template.rb:205:in `render_template'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_view/base.rb:265:in `render'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:134:in `rescue_action_locally'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:152:in `rescue_action_without_handler'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:74:in `rescue_action'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:162:in `rescue in perform_action_with_rescue'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:160:in `perform_action_with_rescue'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/flash.rb:146:in `perform_action_with_flash'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `process'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/filters.rb:606:in `process_with_filters'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/base.rb:391:in `process'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/base.rb:386:in `call'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:437:in `call'
Request
Parameters:
None
Show session dump
Response
Headers:
{"Cache-Control"=>"no-cache",
"Content-Type"=>""}
I don't know if this is the cause of your error. But when I got this error, it was because I unthinkingly defined a "response" action in my controller. Renamed the action, and all was well.
Code Example:
class PagesController < ApplicationController
def request
end
def response
end
end
What action are you trying to call in the controller ?
check the action_name in the controller !