We can pass local variable to partial as follow.
<%= render :partial => 'shard/test', :locals => {:foo => "bar", :foos => ["bar1", "bar2"]} %>
Continue reading
We can pass local variable to partial as follow.
<%= render :partial => 'shard/test', :locals => {:foo => "bar", :foos => ["bar1", "bar2"]} %>
Continue reading
Paperclip helps you implementing file attachment with ActiveRecord with Rails. Follow the example below and see how it works. Continue reading
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 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
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
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
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
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
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
I have been working on Rails for more than half year and i do file editing with vi at server side most of the time. vi is a great tool but it is not convenient for editing multiple files which is very common in programmer. In the past, I had to close the file, cd to another directory and opened another file for editing. Continue reading