The very first thing that the active scaffold show method does(after validations) is calls this method
def do_show @record = find_if_allowed(params[:id], :read) end So all you have to do is override this method in the controller. You already had the right idea by setting a record to @record and rendering the action :-) ~Kenny On Tue, Jul 7, 2009 at 10:35 AM, Soren Christensen <[email protected]>wrote: > > Users is already an AS controller. Its a hybrid of the users that can log > in, and the users that are also the parents. So there are substantially more > fields in my users model that what you would see in some other cases. > Parents and Users are used interchangeably. > > Users/Parents has a number of Students so just sending the student.id to > the show action does not work. > That was why I had the two lookup's to get the the parent ID before > rendering the show. > Is there way to reference the show and have the ability to control what > record is show. > > Next step is to apply the privacy rules to the displayed data. I assume > that this can be done with helper methods. > > /S > > > > Kenny Ortmann wrote: > > You could make a User Controller and use the show method in the user > controller and then just configure the action link to point to that > controller. But from the look of things you are using the User controller > as an Active Scaffold controller already aren't you? > > When you say Parent, the parent is just the parent record correct? > > ~Kenny > > On Tue, Jul 7, 2009 at 7:15 AM, Soren Christensen <[email protected]>wrote: > >> >> Hi, >> >> I have a User mode, and a Student model and use AS for all of my CRUD >> action. >> >> I'm trying to build a function that should show the parents of a >> particular student. Would love to make it an 'visual extension' to AS. >> >> But how - the rails portion was easy - but how do I display it ? >> Shall I grab the show method/template from AS and user that as a >> template or is there a better method. >> >> Just trying to do: >> >> def parents >> >> student= Student.find(params[:id]) >> >> @record = User.find(student.user_id) >> >> render :controller => 'users', :action => 'show', :id => @record.id >> >> end >> >> >> Gives me what I want, but the headline is wrong ! >> It shows : >> >> Show Student (Should have been Show User) >> and then it gives me the items the the show view is configured to display. >> >> Is there a better way to do this ? >> >> And can one grab >> >> vendor/plugins/active_scaffold/frontends/default/views/_show_columns.html.erb, >> and placed a modified version in my view directory to customize the view. >> >> /S >> >> >> >> >> >> > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en -~----------~----~----~----~------~----~------~--~---
