RestFul with RJS

Hello,

I am using the plugin simply Restful. I would like to use also RJS. So i
try to make a li test.

in index.rhtml

Ajouter une nouvelle catégorie
<% form_remote_for :faq_category, :url => faq_category_url, :html =>
{ :method => :post } do |f| %>
<%= error_messages_for (:faq_category) %>

Libelle <%= f.text_field
:libelle_fr %>


La catégories est visible <%= f.check_box(:est_valable) %>


<%= submit_tag ‘ajouter’ %>
<% end %>

<%= link_to_function(‘Annuler’, “Element.toggle(‘add_category’)”)
%>


in my controller
def create
@faq_category = FaqCategory.new params[:faq_category ]
@faq_category.save! #intecepte toutes les erreurs de sauvegardes
redirect_to_index (“nouvelle catégorie crée”) #Redérige à la vue
index
rescue ActiveRecord::RecordInvalid #intercepte les execeptions
render :action => “new”
end

in my RJS ‘new.rjs’
page.alert ‘test’

So when i try to add a new category it’s working however i don’t see the
alert in my new.rjs

Thanks for your help

I have alse a problem with edit method
<%= link_to_remote (“Edit”,
:update => ‘div_categorie’,
:url => edit_faq_category_path(t)) %>
When i test to use link_to_remote i can see this error message

Routing Error

no route found to match “/faq_categories/1;edit” with {:method=>:post}

:frowning:

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