I to the part of the tutorial where a User model is created. It has
the following attributes:
# id :integer(4) not null, primary key
# name :string(255)
# email :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# password_digest :string(255)
#

Then in an rspec test file the author issues this command:
before do
@user = User.new(name: "Example User", email: "user@example.com",
password: "foobar", password_confirmation:
"foobar")
end

Now he says that password and password_confirmation are created
temporarily in memory and don't need to go into the database. But
when I try to run this rspec test it gives me an error stating unknown
attribute: password.

Can anyone help me get around this?
thanx,
mike

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Sergey Ezhov at May 6, 2012 at 8:10 am
    I simply add in model:
    attr_accessible ... :password, :password_confirmation, ...

    it work
    but it can not absolutely truly

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Rodrigo Vieira at May 7, 2012 at 3:02 pm
    Be aware that, it is not safe to set passwords changeable via mass-assignment.
    On 06/05/2012, at 05:10, Sergey Ezhov wrote:

    I simply add in model:
    attr_accessible ... :password, :password_confirmation, ...

    it work
    but it can not absolutely truly

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Sergey Ezhov at May 8, 2012 at 11:38 am

    Rodrigo Vieira wrote in post #1059872:
    Be aware that, it is not safe to set passwords changeable via
    mass-assignment.
    Your decision, please? How it to solve?

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Azizmb.in at May 8, 2012 at 11:46 am
    Have you tried using Rails builtin confirmation
    mechanism<http://guides.rubyonrails.org/active_record_validations_callbacks.html#confirmation>
    ?
    On Tue, May 8, 2012 at 5:08 PM, Sergey Ezhov wrote:

    Rodrigo Vieira wrote in post #1059872:
    Be aware that, it is not safe to set passwords changeable via
    mass-assignment.
    Your decision, please? How it to solve?

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.

    --
    - Aziz M. Bookwala

    Website <http://azizmb.in/> | Twitter <https://twitter.com/azizbookwala> |
    Github <http://github.com/azizmb>

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Sergey Ezhov at May 8, 2012 at 1:47 pm
    This example doesn't work without 'attr_accessable: ... , :password,
    :password_confirmation ...'
    and with
    'has_secure_password'

    How to set the record field comming from form field?

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Vishal singh at May 8, 2012 at 2:41 pm
    In users table their is wrong field name i.e password_digest,it should be
    only password not password_digest
    On Tue, May 8, 2012 at 7:16 PM, Sergey Ezhov wrote:

    This example doesn't work without 'attr_accessable: ... , :password,
    :password_confirmation ...'
    and with
    'has_secure_password'

    How to set the record field comming from form field?

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Sergey Ezhov at May 11, 2012 at 8:35 am

    vishal singh wrote in post #1060022:
    In users table their is wrong field name i.e password_digest,it should
    be
    only password not password_digest
    Someone mentioned 'password_digest'? Only 'password' and
    'password_confirmation'.

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedMay 5, '12 at 1:25p
activeMay 11, '12 at 8:35a
posts8
users5
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase