Note that there are some explanatory texts on larger screens.

plurals
  1. POTODO LIST with devise
    primarykey
    data
    text
    <p>I made an application of TODO List.</p> <p>I install the devise and want to define two kinds of users:</p> <pre><code>1) admin 2) worker </code></pre> <p>so I will create the admin controller. for meantime, I created the user_controller.</p> <p>I want to force sign in, in order to let the worker update his tasks (done or not), so I tried:</p> <pre><code>class WorkersController &lt; ApplicationController before_filter :authenticate_user! </code></pre> <p>p.s, my model's name is user.rb:</p> <pre><code>class User &lt; ActiveRecord::Base # Include default devise modules. Others available are: # :token_authenticatable, :lockable, :timeoutable, :confirmable and :activatable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation # attr_accessible :title, :body end </code></pre> <p>but, :authenticate_user! is not work. I can create a task even I log out.</p> <p>and after that, I have to know what is the mail of the user that signed in (in order to update his tasks). so I have to write something like:</p> <pre><code>def index @email = params[:session][:email] </code></pre> <p>but I got an error:</p> <pre><code>NoMethodError in WorkersController#index undefined method `[]' for nil:NilClass Rails.root: /home/alon/projects/TODOLIST Application Trace | Framework Trace | Full Trace app/controllers/workers_controller.rb:8:in `index' </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload