The above creates the user in the db and confirms the user. However,
in the background, Devise also sends out an email, along the lines of
"Welcome foo...@email.com! You can confirm your account through the
link below: Confirm my account".
Is it possible to skip the confirmation email and just confirm this
user for this instance?
> The above creates the user in the db and confirms the user. However, > in the background, Devise also sends out an email, along the lines of > "Welcome foo...@email.com! You can confirm your account through the > link below: Confirm my account".
> Is it possible to skip the confirmation email and just confirm this > user for this instance?
> > # Confirm the user for Devise
> > user.confirm!
> > The above creates the user in the db and confirms the user. However,
> > in the background, Devise also sends out an email, along the lines of
> > "Welcome foo...@email.com! You can confirm your account through the
> > link below: Confirm my account".
> > Is it possible to skip the confirmation email and just confirm this
> > user for this instance?
> On Sep 28, 5:03 am, Carlos Antonio da Silva > <carlosantoniodasi...@gmail.com> wrote: > > Yes it is: call skip_confirmation! and then save the record
> > > # Confirm the user for Devise > > > user.confirm!
> > > The above creates the user in the db and confirms the user. However, > > > in the background, Devise also sends out an email, along the lines of > > > "Welcome foo...@email.com! You can confirm your account through the > > > link below: Confirm my account".
> > > Is it possible to skip the confirmation email and just confirm this > > > user for this instance?
Nope, that wont work. Devise sends the email when the user is created.
I am still getting confirmation emails. So I don't think it ever
reaches skip_confirmation!
> > On Sep 28, 5:03 am, Carlos Antonio da Silva
> > <carlosantoniodasi...@gmail.com> wrote:
> > > Yes it is: call skip_confirmation! and then save the record
> > > > # Confirm the user for Devise
> > > > user.confirm!
> > > > The above creates the user in the db and confirms the user. However,
> > > > in the background, Devise also sends out an email, along the lines of
> > > > "Welcome foo...@email.com! You can confirm your account through the
> > > > link below: Confirm my account".
> > > > Is it possible to skip the confirmation email and just confirm this
> > > > user for this instance?
> > On Sep 28, 5:03 am, Carlos Antonio da Silva
> > <carlosantoniodasi...@gmail.com> wrote:
> > > Yes it is: call skip_confirmation! and then save the record
> > > > # Confirm the user for Devise
> > > > user.confirm!
> > > > The above creates the user in the db and confirms the user. However,
> > > > in the background, Devise also sends out an email, along the lines of
> > > > "Welcome foo...@email.com! You can confirm your account through the
> > > > link below: Confirm my account".
> > > > Is it possible to skip the confirmation email and just confirm this
> > > > user for this instance?
christian.fazz...@gmail.com> wrote: > On the other hand,
> user = User.new(params here) > user.skip_confirmation! > user.save!
> Works! :-)
> On Sep 28, 5:18 am, Carlos Antonio da Silva > <carlosantoniodasi...@gmail.com> wrote: > > IIRC, skip_confirmation! does not save the record, so you'd have to do > sth > > like:
> > > On Sep 28, 5:03 am, Carlos Antonio da Silva > > > <carlosantoniodasi...@gmail.com> wrote: > > > > Yes it is: call skip_confirmation! and then save the record
> > > > > # Confirm the user for Devise > > > > > user.confirm!
> > > > > The above creates the user in the db and confirms the user. > However, > > > > > in the background, Devise also sends out an email, along the lines > of > > > > > "Welcome foo...@email.com! You can confirm your account through > the > > > > > link below: Confirm my account".
> > > > > Is it possible to skip the confirmation email and just confirm this > > > > > user for this instance?
Now I am trying to authenticate the user through facebook. I get this
error:
NoMethodError in Devise/oauth callbacksController#facebook
undefined method `persisted?' for true:TrueClass
In my user model, I have:
def self.find_for_facebook_oauth(access_token, signed_in_resource=nil)
data = ActiveSupport::JSON.decode(access_token.get('https://
graph.facebook.com/me?'))
if user = User.find_by_email(data['email'])
user
else
# Create an user with a stub password.
user = User.new(
:email => data['email'],
:first_name => data['first_name'],
:last_name => data['last_name'],
:password => 'password123',
:password_confirmation => 'password123'
)
user.skip_confirmation!
user.save!
end
end
However, with the following code below, everything seems to work...
Why is this error coming up?
Arent both methods the same?
def self.find_for_facebook_oauth(access_token, signed_in_resource=nil)
data = ActiveSupport::JSON.decode(access_token.get('https://
graph.facebook.com/me?'))
if user = User.find_by_email(data['email'])
user
else
# Create an user with a stub password.
user = User.create!(
:email => data['email'],
:first_name => data['first_name'],
:last_name => data['last_name'],
:password => 'password123',
:password_confirmation => 'password123'
)
end
end
> > On Sep 28, 5:18 am, Carlos Antonio da Silva
> > <carlosantoniodasi...@gmail.com> wrote:
> > > IIRC, skip_confirmation! does not save the record, so you'd have to do
> > sth
> > > like:
> > > > On Sep 28, 5:03 am, Carlos Antonio da Silva
> > > > <carlosantoniodasi...@gmail.com> wrote:
> > > > > Yes it is: call skip_confirmation! and then save the record
> > > > > > # Confirm the user for Devise
> > > > > > user.confirm!
> > > > > > The above creates the user in the db and confirms the user.
> > However,
> > > > > > in the background, Devise also sends out an email, along the lines
> > of
> > > > > > "Welcome foo...@email.com! You can confirm your account through
> > the
> > > > > > link below: Confirm my account".
> > > > > > Is it possible to skip the confirmation email and just confirm this
> > > > > > user for this instance?
> > > > > --
> > > > > At.
> > > > > Carlos A. da Silva
The stub method that is given for git and facebook when I saw it in some blogs, is incorrect, I believe.
You need to return 'user'. user.save! returns true on success...
To fail gracefully, you return a User instance that you have not saved to the database, so the version of save that raises an exception is probably not what you want.
-Alex
On Mon, Sep 27, 2010 at 4:19 PM, Christian Fazzini
<christian.fazz...@gmail.com> wrote: > Ok this seems to work for seeds.
> Now I am trying to authenticate the user through facebook. I get this > error:
> NoMethodError in Devise/oauth callbacksController#facebook > undefined method `persisted?' for true:TrueClass
> In my user model, I have:
> def self.find_for_facebook_oauth(access_token, signed_in_resource=nil) > data = ActiveSupport::JSON.decode(access_token.get('https:// > graph.facebook.com/me?'))
> if user = User.find_by_email(data['email']) > user > else > # Create an user with a stub password. > user = User.new( > :email => data['email'], > :first_name => data['first_name'], > :last_name => data['last_name'], > :password => 'password123', > :password_confirmation => 'password123' > ) > user.skip_confirmation! > user.save! > end > end
> However, with the following code below, everything seems to work... > Why is this error coming up?
> Arent both methods the same?
> def self.find_for_facebook_oauth(access_token, signed_in_resource=nil) > data = ActiveSupport::JSON.decode(access_token.get('https:// > graph.facebook.com/me?'))
> if user = User.find_by_email(data['email']) > user > else > # Create an user with a stub password. > user = User.create!( > :email => data['email'], > :first_name => data['first_name'], > :last_name => data['last_name'], > :password => 'password123', > :password_confirmation => 'password123' > ) > end > end
> On Sep 28, 7:03 am, Carlos Antonio da Silva > <carlosantoniodasi...@gmail.com> wrote: >> Sure, we were using User.create =D
>> On Mon, Sep 27, 2010 at 8:02 PM, Christian Fazzini <
>> christian.fazz...@gmail.com> wrote: >> > On the other hand,
>> > On Sep 28, 5:18 am, Carlos Antonio da Silva >> > <carlosantoniodasi...@gmail.com> wrote: >> > > IIRC, skip_confirmation! does not save the record, so you'd have to do >> > sth >> > > like:
>> > > > On Sep 28, 5:03 am, Carlos Antonio da Silva >> > > > <carlosantoniodasi...@gmail.com> wrote: >> > > > > Yes it is: call skip_confirmation! and then save the record
>> > > > > > # Confirm the user for Devise >> > > > > > user.confirm!
>> > > > > > The above creates the user in the db and confirms the user. >> > However, >> > > > > > in the background, Devise also sends out an email, along the lines >> > of >> > > > > > "Welcome foo...@email.com! You can confirm your account through >> > the >> > > > > > link below: Confirm my account".
>> > > > > > Is it possible to skip the confirmation email and just confirm this >> > > > > > user for this instance?
>> > > > > -- >> > > > > At. >> > > > > Carlos A. da Silva
I am returning the user object. This seems to work now.
By the way, when I try to use Devise.friendly_token, as such:
User.create!(:email => data['email'], :password =>
Devise.friendly_token), I always get "password is too long, maximum is
20" (or similar message). It seems Devise.friendly_token as given in
the git examples is wrong?
> The stub method that is given for git and facebook when I saw it in
> some blogs, is incorrect, I believe.
> You need to return 'user'.
> user.save! returns true on success...
> To fail gracefully, you return a User instance that you have not saved
> to the database, so the version of save that raises an exception is
> probably not what you want.
> -Alex
> On Mon, Sep 27, 2010 at 4:19 PM, Christian Fazzini
> <christian.fazz...@gmail.com> wrote:
> > Ok this seems to work for seeds.
> > Now I am trying to authenticate the user through facebook. I get this
> > error:
> > NoMethodError in Devise/oauth callbacksController#facebook
> > undefined method `persisted?' for true:TrueClass
> >> > On Sep 28, 5:18 am, Carlos Antonio da Silva
> >> > <carlosantoniodasi...@gmail.com> wrote:
> >> > > IIRC, skip_confirmation! does not save the record, so you'd have to do
> >> > sth
> >> > > like:
> >> > > > On Sep 28, 5:03 am, Carlos Antonio da Silva
> >> > > > <carlosantoniodasi...@gmail.com> wrote:
> >> > > > > Yes it is: call skip_confirmation! and then save the record
> >> > > > > > # Confirm the user for Devise
> >> > > > > > user.confirm!
> >> > > > > > The above creates the user in the db and confirms the user.
> >> > However,
> >> > > > > > in the background, Devise also sends out an email, along the lines
> >> > of
> >> > > > > > "Welcome foo...@email.com! You can confirm your account through
> >> > the
> >> > > > > > link below: Confirm my account".
> >> > > > > > Is it possible to skip the confirmation email and just confirm this
> >> > > > > > user for this instance?
> >> > > > > --
> >> > > > > At.
> >> > > > > Carlos A. da Silva
> >> > > --
> >> > > At.
> >> > > Carlos A. da Silva
> I am returning the user object. This seems to work now.
> By the way, when I try to use Devise.friendly_token, as such: > User.create!(:email => data['email'], :password => > Devise.friendly_token), I always get "password is too long, maximum is > 20" (or similar message). It seems Devise.friendly_token as given in > the git examples is wrong?
> On Sep 28, 7:31 am, Alex <x37v.a...@gmail.com> wrote: > > The stub method that is given for git and facebook when I saw it in > > some blogs, is incorrect, I believe.
> > You need to return 'user'. > > user.save! returns true on success...
> > To fail gracefully, you return a User instance that you have not saved > > to the database, so the version of save that raises an exception is > > probably not what you want.
> > -Alex
> > On Mon, Sep 27, 2010 at 4:19 PM, Christian Fazzini
> > <christian.fazz...@gmail.com> wrote: > > > Ok this seems to work for seeds.
> > > Now I am trying to authenticate the user through facebook. I get this > > > error:
> > > NoMethodError in Devise/oauth callbacksController#facebook > > > undefined method `persisted?' for true:TrueClass
> > >> > On Sep 28, 5:18 am, Carlos Antonio da Silva > > >> > <carlosantoniodasi...@gmail.com> wrote: > > >> > > IIRC, skip_confirmation! does not save the record, so you'd have > to do > > >> > sth > > >> > > like:
> > >> > > > On Sep 28, 5:03 am, Carlos Antonio da Silva > > >> > > > <carlosantoniodasi...@gmail.com> wrote: > > >> > > > > Yes it is: call skip_confirmation! and then save the record
> > >> > > > > > # Confirm the user for Devise > > >> > > > > > user.confirm!
> > >> > > > > > The above creates the user in the db and confirms the user. > > >> > However, > > >> > > > > > in the background, Devise also sends out an email, along the > lines > > >> > of > > >> > > > > > "Welcome foo...@email.com! You can confirm your account > through > > >> > the > > >> > > > > > link below: Confirm my account".
> > >> > > > > > Is it possible to skip the confirmation email and just > confirm this > > >> > > > > > user for this instance?
> > >> > > > > -- > > >> > > > > At. > > >> > > > > Carlos A. da Silva
> > >> > > -- > > >> > > At. > > >> > > Carlos A. da Silva
> I am returning the user object. This seems to work now.
> By the way, when I try to use Devise.friendly_token, as such: > User.create!(:email => data['email'], :password => > Devise.friendly_token), I always get "password is too long, maximum is > 20" (or similar message). It seems Devise.friendly_token as given in > the git examples is wrong?
> On Sep 28, 7:31 am, Alex <x37v.a...@gmail.com> wrote: >> The stub method that is given for git and facebook when I saw it in >> some blogs, is incorrect, I believe.
>> You need to return 'user'. >> user.save! returns true on success...
>> To fail gracefully, you return a User instance that you have not saved >> to the database, so the version of save that raises an exception is >> probably not what you want.
>> -Alex
>> On Mon, Sep 27, 2010 at 4:19 PM, Christian Fazzini
>> <christian.fazz...@gmail.com> wrote: >> > Ok this seems to work for seeds.
>> > Now I am trying to authenticate the user through facebook. I get this >> > error:
>> > NoMethodError in Devise/oauth callbacksController#facebook >> > undefined method `persisted?' for true:TrueClass
>> >> > On Sep 28, 5:18 am, Carlos Antonio da Silva >> >> > <carlosantoniodasi...@gmail.com> wrote: >> >> > > IIRC, skip_confirmation! does not save the record, so you'd have to do >> >> > sth >> >> > > like:
>> >> > > > On Sep 28, 5:03 am, Carlos Antonio da Silva >> >> > > > <carlosantoniodasi...@gmail.com> wrote: >> >> > > > > Yes it is: call skip_confirmation! and then save the record
>> >> > > > > > # Confirm the user for Devise >> >> > > > > > user.confirm!
>> >> > > > > > The above creates the user in the db and confirms the user. >> >> > However, >> >> > > > > > in the background, Devise also sends out an email, along the lines >> >> > of >> >> > > > > > "Welcome foo...@email.com! You can confirm your account through >> >> > the >> >> > > > > > link below: Confirm my account".
>> >> > > > > > Is it possible to skip the confirmation email and just confirm this >> >> > > > > > user for this instance?
>> >> > > > > -- >> >> > > > > At. >> >> > > > > Carlos A. da Silva
>> >> > > -- >> >> > > At. >> >> > > Carlos A. da Silva