SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Row not updating...

    I am using this:
    Code Ruby:
    user = Users.first(:conditions => {:username => params[:user][:username], :email => params[:user][:email]}, :select => 'first_name, email')
    user.update_attribute('password', password)

    However when I look in phpMyAdmin the row is not updated... am I doing something wrong?
    Have a good day.

  2. #2
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also guys does Rails update the database when in development environment or send email in that environment?
    Have a good day.

  3. #3
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Using update_attribute should both add the new attribute and save the object to the database. However, it will do so in a way that will bypass validation so it's usually not the best method to use:
    http://api.rubyonrails.com/classes/A...e.html#M002280

    Standard Rails convention is to have three versions of your database. Each database is suffixed with the environment name after an underscore. So for a database called "database", there will be database_production, database_development, database_production. When in development, data will be read to and written from database_development. When in production data will be read and written from database_production. Check config/database.yml for the configuration your application is using.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •