Hi everybody, in my view (operation_en_cours) I display the content of a
variable (myvariable) and I have a button linked to a method ( for
exemple change)defined in my controller in which I change the content of
my varible like this:
@myvariable="hello"
def change
@myvariable="test"
respond_to do |format|
format.html { redirect_to pages_operation_en_cours_url }
format.json { head :no_content }
end
But when I click on the button my fonction is called y saw it in the url
(
http://192.168.152.196:3000/pages/change) but then in the view I always
have "hello". I think the is not refresh but I don't no how can I do?
Indeed if I define myvarible like this @myvariable=Article.all and then
def change
@myvariable[0].name="test"
@myvariable[0].save
respond_to do |format|
format.html { redirect_to pages_operation_en_cours_url }
format.json { head :no_content }
end
and in my view @myvarible[0].name then when I call the method the view
is refresh and the name is change.
How can I do the "equivalent" of save for my variable?
Fab
--
Posted via
http://www.ruby-forum.com/.