My code:
# app/controllers/log_controller.rb
class LogController < ApplicationController
def in
@user = User.login(params[:login])
respond_to do |format|
format.js
end
end
end
# app/views/log/in.js.erb
redirect_to("/myprofile")
# public/javascript/application.js
function redirect_to(url) { location.href = url; }...
Hey guys, do any of you know any good reference for the RJS mechanisms in Rails (2.3.8) I can find a few examples from like 2006/2007 and no actual documentation.
...
Hi,
i have an .js.rjs file, that must be used in many places.
How can i reuse it ?
For example, in my .js.rjs file i need something like this:
page << ( render "widely_used_stuff" )
where "widely_used_stuff" is a widely_used_stuff.js.rjs file, that contains the code, used in many places.
Also, i need to pass the variables to widel...
Hello,
I want users to be able to comment on submissions. Below each submission I want there to be a link that says "Comments (2)"...when you click on this link it dynamically loads in the comments, as well as a simple form to add a new comment. When the user submits a new comment I want it to load asynchronously in at the bottom of the...
Rails - 3.0 - Trying to make an ajax call but I run into an error.
Controller - Home
def test
end
View - home#index
<div class="test">
Testing here
</div><%= link_to 'Test', test_path, :remote=>true %>
View - test.rjs
page[:test].replace_html :partial => "home/blah"
When I click on the link I get this -
try {
$("test"...
I have an event form with some nested attribute models. The additional models are rendered after a client is selected from a select box. An observer watches and calls a controller action which renders a partial containing the fields_for nested models. The issue I'm having is that I can't pass the event 'form' block to the newly rendered ...
I can't believe I've been looking four hours for this simple task, but I have.
In Rails 2.3, I could replace one section of a page with this simple code:
render :update do |page|
page.replace_html "div_id", :partial => "new_content",...
end
In Rails 3, Ryan Bates has me writing entire new javascript functions, switching from Protot...
I have a page form, where i want the user to add nested forms by clicking on a remote link ('add photo', f. ex). Upon clicking the button I inject the nested forms with RJS. The injected forms are remote forms, but after injection the forms have no javascript events attached so they just submit with http to the controller of the nested o...