on 2006-03-14 12:43
on 2006-03-14 13:05
Hi, I didn't try RJS templates yet, but from what I understand if there are both a .rhtml and a .rjs template, then rails picks up the .rhtml one. Waht you'll want to do in your add action is change the view produced by a _different_ action. HTH, Michael
on 2006-03-14 13:14
> > Created the files add.rhtml and add.rjs in views/dtest/ ,and > dtest.rhtml in views/layouts. > The tutorial says: Rails now looks for templates with an extension of .rjs, in addition to .rhtml and .rxml, so create a view named add.rjs for your controller and add the following code to it: bla, bla.... It doesn't say anything about create a .rhtml view. It only says that last version of Rails search for templates .rjs too. I haven't used RJS but I think you only need .rjs view to follow the tutorial.
on 2006-03-14 13:26
What I understand is that the .rjs page (which must have the same name with the .rhtml page) is used -- after -- the page is rendered >From the tutorial>>> Unlike conventional templates which are used to render the results of an action, these templates generate instructions on how to modify an already rendered page. This makes it easy to modify multiple elements on your page in one declarative Ajax response. Actions with these templates are called in the background with Ajax and make updates to the page where the request originated from. >>> Ovidiu
on 2006-03-14 13:32
Ovidiu EFTIMIE wrote: > What I understand is that the .rjs page (which must have the same name > with the .rhtml page) is used -- after -- the page is rendered No, it must not have the same name. There could potientially be several actions wanting to change the rendered page in some way, so they have to be distinct from the action that originally rendered the page. Give it a try and make different actions for rendering and changing the page...
on 2006-03-14 13:48
on 2006-03-14 15:05
I've added an index action class DtestController < ApplicationController def index end def add end end and renamed the add.rhtml to index.rhtml. Now it works well. Acctually at the beggining id didn't work at all . I've deleted the ruby session from %TEMP% and then is started to work Thanx, Ovidiu
on 2006-03-14 15:17
Thanx Alan. Much clearer:)