I want to add an object (@attachment) to the new and edit actions in the controller for devise. Unfortunately I don't know how and where to do this. :|
You can customize the registrations controller with the same approach shown in the docs: https://github.com/plataformatec/devise#configuring-controllers
And you could instantiate the object using a private method and before_filter, like so:
#in controllers/registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController
before_filter :init_attachment, only: [:new, :edit]
private
def init_attachment
@attachment #= ...
end
end
Hope it helps!