We can pass local variable to partial as follow.
<%= render :partial => 'shard/test', :locals => {:foo => "bar", :foos => ["bar1", "bar2"]} %>
We can pass local variable to partial as follow.
<%= render :partial => 'shard/test', :locals => {:foo => "bar", :foos => ["bar1", "bar2"]} %>
Paperclip helps you implementing file attachment with ActiveRecord with Rails. Follow the example below and see how it works. Continue reading Rails – File Upload with Paperclip
Previously i have created a countries table which contains a country name and country code field. Get more information in the following link.
Rails – Preset Data in Database by Seed Fu Continue reading Rails – Create Some Simples Search Methods in ActiveRecord
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
Now i have the country hash ready which is all we need to build a selection list in view.
Rails – Retrieve a Hash from Model Continue reading Rails – Selection List on Form Builder
I would like to add a selection list country field in a view but first i need to get the a country hash from the Country model. Continue reading Rails – Retrieve a Hash from Model
I want to have a country field in my User model and i want it to be a selection list instead of free text input. So i plan to have a countries table which contains all the possible options as of the ISO 3166 country list. Continue reading Rails – Preset Data in Database by Seed Fu
Previous related post: Rails – Find Location using Geocoder
Implementation of Geocoder on Model is simple and straight forward. What we need is just adding two more columns on the Model table for storing the coordinates(Latitude & Longitude) and one column for storing the address. Continue reading Rails – Implementation of Geocoder on Model
Geocoder is a Rails Gem which helps you to manipulate location in your Rails application. It is written by Alex Reisner. Thanks for his work and you can find out more details at Github – alexreisner / geocoder.
Let’s try it now. Continue reading Rails – Find Location using Geocoder
I have created a delete link in the view to delete an object using link_to in Rails but whenever i click the link it goes to the :show method instead of prompting a Javascript alert box for delete confirmation. Here is the code in the view. Continue reading Rails – link_to :delete fails