This is about as beginner as a question gets, but I can’t find anything in the ruby docs or on google that helps.
It’s a very simple question; how do I commit an ActiveRecord object to the database?
I have my user.rb file in models which just contains the two lines;
class User < ActiveRecord::Base
end
I have a users table in postgres that has only two fields, id and email.
And I have the following line in my signup controller;
User.new(:email => email)
It doesn’t kick an error so I assume that the new User object is created just fine, and that it’s happy about being given an ’email’ field, which leads me to believe that it is correctly reading its own field list from the database, but no record is created.
You can do two things to persist an object to the database:
Or:
You’re right that this is a fairly beginnery question, but that’s nothing to be ashamed of! You should probably read the Ruby on Rails Getting Started Guide which introduces this and many more helpful concepts.