RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: ipatovanton
Site: freelanceme.ru
Has anyone know how to move create method into worker?
def create @project = Project.find(params[:project_id]) @photo = @project.photos.build(params[:photo]) @photo.user = current_user if @photo.save redirect_to image_upload_project_path(@project) end end
Hi can you help me I'm trying to open rails console and getting this deployer@microv:~$ rails console -bash: rails: command not found
Now I have
def send_password_reset create_remember_token self.password_reset_sent_at = Time.zone.now save! UserMailer.password_reset(self).deliver end def create_remember_token self.remember_token = SecureRandom.urlsafe_base64 end
and now I have problem with find user undefined methodfind_by_create_remember_token!' for #Class:0x007fca97926210`
undefined method
Hi when I try to reset password I get this error: ArgumentError in PasswordResetsController#create
ArgumentError in PasswordResetsController#create
wrong number of arguments (1 for 0)
app/models/user.rb:48:increate_remember_token' app/models/user.rb:40:in send_password_reset' app/controllers/password_resets_controller.rb:7:increate'`
app/models/user.rb:48:in
send_password_reset' app/controllers/password_resets_controller.rb:7:in
class PasswordResetsController < ApplicationController def new end def create user = User.find_by_email(params[:email]) user.send_password_reset if user redirect_to root_url end def edit @user = User.find_by_password_reset_token!(params[:id]) end def update @user = User.find_by_password_reset_token!(params[:id]) if @user.password_reset_sent_at < 2.hours.ago redirect_to new_password_reset_path, :alert => "Password ↵ reset has expired." elsif @user.update_attributes(params[:user]) redirect_to root_url, :notice => "Password has been reset." else render :edit end end end
class User < ActiveRecord::Base attr_accessible :email, :lname, :name, :password, :password_confirmation, has_secure_password before_save { |user| user.email = email.downcase } before_save :create_remember_token validates :name, presence: true, length: { maximum: 50 } validates :lname, presence: true, length: { maximum: 50 } VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false } validates :password, presence: true, :on => :create validates :password, length: { minimum: 6 }, :allow_blank => true validates :password_confirmation, presence: true, :on => :create def send_password_reset create_remember_token(:password_reset_token) self.password_reset_sent_at = Time.zone.now save! UserMailer.password_reset(self).deliver end private def create_remember_token self.remember_token = SecureRandom.urlsafe_base64 end end
Have anybody an Idea why?
Hi anyone know how to add advanced search, by name and address ...???
Has anyone know how to move create method into worker?
Hi can you help me
I'm trying to open rails console and getting this
deployer@microv:~$ rails console
-bash: rails: command not found
Now I have
and now I have problem with find user
undefined method
find_by_create_remember_token!' for #Class:0x007fca97926210`Hi when I try to reset password I get this error:
ArgumentError in PasswordResetsController#create
wrong number of arguments (1 for 0)
app/models/user.rb:48:in
create_remember_token'app/models/user.rb:40:in
send_password_reset'
create'`app/controllers/password_resets_controller.rb:7:in
Have anybody an Idea why?
Hi anyone know how to add advanced search, by name and address ...???