Easy A
Would you like to react to this message? Create an account in a few clicks or log in to continue.


 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

Share
 

 Rails controllers - 1 for every model?

View previous topic View next topic Go down 
AuthorMessage
Database
Member
Member
Database

Posts : 318
Join date : 2012-03-04

Rails controllers - 1 for every model? Empty
PostSubject: Rails controllers - 1 for every model?   Rails controllers - 1 for every model? EmptyFri Jul 27, 2012 10:52 pm

I've been going through some RoR tuts and reading Agile Web Developer with Ruby on Rails (I think thats what the book is called) and I've created an admin controller BUT I want the admin controller to manage multiple models as my application isnt run on a single model. In the Depot application with the book I'm reading their admin controller only manages a single table/model. In other examples I've seen, they create a controller for every model.
Is it possible to have multiple scaffolds in a single controller? Or am I totally missing the point.
Back to top Go down
Database
Member
Member
Database

Posts : 318
Join date : 2012-03-04

Rails controllers - 1 for every model? Empty
PostSubject: Re: Rails controllers - 1 for every model?   Rails controllers - 1 for every model? EmptyFri Jul 27, 2012 10:52 pm

I am also fairly new to rails... But it doesn't matter...

If you were using 2 different models, i forgot your exact post but here's an example of using 2.

def method_name
@user = User.find(@params["id"])
@images = Images.find_all(@params["id"])
end

As far as scaffolding 2 models... Any particular reason you want to? Scaffolding is sort of a temporary guide.
Back to top Go down
 

Rails controllers - 1 for every model?

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» multiple controllers in one view (rails)
» Subdirectory controllers
» Ruby on rails vs. Php
» how ruby/rails work ?
» Toggling <div> Visibility in a Rails App

Permissions in this forum:You cannot reply to topics in this forum
Easy A :: Rails controllers - 1 for every model? Edit-trash Useless :: Trash-