I have the following methods that I want to use in my controller:
def store
"#{business_name} - #{address}" if self.online_store == false
end
def webstore
"#{business_name} - #{website}" if self.online_store == true
end
Right now I am using only 1 of them:
format.json { render :json => @business_stores.collect{|b|{:id => b.id, :name => b.store } } }
I need the :name to search for b.store and b.webstore, how can I do this?
Why don’t you create only one method
And when you will ask for it will know if it’s the online store or not