Jump to content

The ultimate community for Ruby on Rails developers.


Photo

RoR basic question


  • Please log in to reply
1 reply to this topic

#1 jeffreyleeon

jeffreyleeon

    Passenger

  • Members
  • 1 posts

Posted 15 January 2014 - 05:17 AM

I am new in RoR. Started just for few days.

I have created a scaffold Users with name and email

And as I read from the tutorials

There are something

 

@user = User.new

 

or 

 

@user = User.new([:para=id])

 

or 

 

User.create

 

or

 

User.destroy

 

However, I can't see any definition of these User. stuff. Are they created automatically? Or where can I find the User class to see?

Thank you



#2 RoyTheB0y

RoyTheB0y

    Signalman

  • Members
  • 10 posts

Posted 15 January 2014 - 08:21 AM

if you look at your user model you will see it is a subclass of ActiveRecord

 

class User < ActiveRecord::Base

 

the User.stuff you refer to are the inherited methods of the ActiveRecord class

you can read about ActiveRecord here

http://guides.rubyon...ord_basics.html

http://api.rubyonrai...ecord/Base.html


  • keaglin likes this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users