views:

20

answers:

1

I have an ActionMailer Model (Notifier) and a view for the mail. In my controller i build an Array (access_data) that looks like this:

access_data = []
users.each do |user|
  access_data << {'subscriptions' => user.subscriptions, 'login' => user.login}
end

When i create a "normal" view, i can do this:

<% access_data['subscriptions'].each do |subscription| %>
  <%= subscription.service.name %>
<% end %>

But when i do the same in my Notifier-View, i get this error:

undefined method `service' for #<YAML::Object:0x1032bf3f0>

Is this because the Notifier-model extends ActionMailer::Base and not ActiveRecord::Base?

A: 

ActionMailer::Base is different from ActiveRecord::Base. each ActionMailer method represents a different mail that can be sent, it hasn't anything about DB stuff.

apeacox
But in the view i should be able to get the models associations, or not? Where is the difference between "normal" views and mailer-views?
Arne Cordes
mailer views are about the body of the email, not what you see in web-browser. at least, from the controller, you can send the email, then redirect some <SOME WEB PAGE>.
apeacox