Category Archives: Rails

Rails – Passing Local Variables to Partial

We can pass local variable to partial as follow.

<%= render :partial => 'shard/test', :locals => {:foo => "bar", :foos => ["bar1", "bar2"]} %>

Continue reading Rails – Passing Local Variables to Partial

Advertisements

Rails – Simple Ajax Create Form

Rails provides a very easy way to implement Ajax. I got a Service and a ServiceComment models and each service has many service_comments. I have a service_comment create form and a partial which shows all the service_comments of that viewing service in the app/views/services/show.html.erb. Everything works fine without Ajax. Now comes to the Rails magic. Continue reading Rails – Simple Ajax Create Form