<% row.each do |i| %>
<%- if i.nil? -%>
<%= render 'users/signup' %>
<%- elsif i.respond_to?('category_id') -%>
<%# render partial_for_post(i.category_id), :object => i %>
<%= i.module %>
<%- end -%>
<% end %>
if I write i.class it returns Post, so I thought module will be a
method in post_controller.rb. But it's not, can any one tell me, what is
it, and where can I get codes written for i.module.
If i is of the type Post, i.module will call the method module from the Post object in app/models/post.rb, not from a PostsController object as you seem to think it will.
Post. module is not the same as i.module, i is an instance of the Post class that means you can do
Post.name == i.class.name and returns true.
acording to ruby docs this is what a module is
"A [Module](http://ruby-doc.org/core/classes/Module.html) is a collection of methods and
constants. The methods in a module may be
instance methods or module methods. Instance methods appear as methods in a
class when the module is included, module
methods do not. Conversely, module methods may be called without creating
an encapsulating object, while instance methods may not. (See [Module#module_function](http://ruby-doc.org/core/classes/Module.html#M001642))
"
so what do you spect the module method to return from i.module?