I am learning Ruby on Rails from the internet and building one small project. I found some issue. I searched in google to print my data in controller. all are suggest me use puts
but I have tried in puts
not getting any output. here is my code:
users_controller.rb
def index
@categories = Category.includes(:galleries).where(:is_active=> 1)
@categories.each do |catt|
puts catt.name
end
end
Also I got some comment in my previous question they suggest me use render
so I tried this code:
@categories.each do |catt|
render text:catt.inspect
end
return false
Here i am getting error message for using render
Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like "redirect_to(...) and return".
Can you please say me how to get my both string and array record in my controller?
Aucun commentaire:
Enregistrer un commentaire