How can I generate devise sign_in form within different controller?

I am trying to generate devise sign_in form, from the different
controller/views( which is called ‘mains_controller’ in my case)

I asked a question on stackoverflow.com but did not get the satisfiable
answer. You can read the specific question in there.

I am stuck with the ‘build_resource’ from devise. The session_controller
which takes care of sign_in/sign_out has a method call called
‘build_resource.’ It seems that build_resource creates a adequate value
for ‘resource’ and ‘resource_name’ for sign_in form.

<%= form_for(resource, :as => resource_name, :url =>
session_path(resource_name)) do |f| %>

But thats the case in devise related controllers. If i put
‘build_resource’ line with in my own ‘mains_controller’ it throws out
error saying that there is no such method like ‘build_resource.’

How can I resolve this problem?
If I create a form inline ruby code, it seems that

<% if devise_mapping.rememberable? -%>

<%= f.check_box :remember_me %> <%= f.label :remember_me %>


<% end -%>

‘devise_mapping’ part above does not work.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs