Really Simple RJS question

I have a really simple RJS question.

Lets say I have a controller with the action create. I want to handle
the action in a rjs template so I have something like…

def create

respond_to do |format|

format.js
end
end

Now i know an ajax call will result in the program looking for a
create.rjs template to call. The problem is what if I have another
controller with a create action that I also want to use a template with?
Then I would have two different RJS templates called create. Is there a
way to change the default name of the template and instruct the action
to call it. Something like:

format.js => ‘my.rjs’

Thanks,
steve

Yes, off the top of my head it’s:

format.js { render :template => ‘some_dir_in_views/my.rjs’ }

Read the docs on render():
http://api.rubyonrails.com/classes/ActionController/Base.html#M000452

On Mar 15, 12:13 pm, Steve G. [email protected]

Thanks Jeff I will have a look!

Jeff Emminger wrote:

Yes, off the top of my head it’s:

format.js { render :template => ‘some_dir_in_views/my.rjs’ }

Read the docs on render():
http://api.rubyonrails.com/classes/ActionController/Base.html#M000452

On Mar 15, 12:13 pm, Steve G. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs