SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot Koobi's Avatar
    Join Date
    Nov 2003
    Location
    Sri Lanka
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Connect model and controller who have different names

    Hi,

    I'm new to ROR and I've read a few old tutorials and they show that you can first create a model named "product", for example, and then create a controller named "admin" and within ActiveController, you can use scaffold to tell the controller which model to use.

    But I know that in the new rails, you could create a model using scaffold from 'script/generate'...but once i'm done creating the model with scaffold and the controller (assume both have different names), how do I tell the controller X to use model Y, for example?

    Thanks.

  2. #2
    SitePoint Zealot Koobi's Avatar
    Join Date
    Nov 2003
    Location
    Sri Lanka
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was just googling on this matter...does "streamlined" in script/generate solve this problem? And if so, what is the best way to use it to solve my issue?

  3. #3
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look in the controller's file. You can change the model there.

  4. #4
    SitePoint Zealot Koobi's Avatar
    Join Date
    Nov 2003
    Location
    Sri Lanka
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm a beginner and I have absolutely no idea how to do this. Maybe at least give me a hint on what I would have to read up on to do this?

  5. #5
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's Rails' docs page: http://www.rubyonrails.org/docs

    The tutorials are all a bit outdated as far as I know. Your best bet is probably the sitepoint tutorial. If you feel like you need more than the API docs after you've read this tutorial you probably have to buy a book.


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
  •