I am using Ruby 1.9.3 and Rails 3.2.16.
I written program to get data for each month and I have add search
feature for month.
In Model:
def self.search(search)
if search
find(:all, :conditions => ['month LIKE ?',
"%#{search}%"])
else
find(:all)
end
end
In controller:
def index
@quantities = Quantity.search(params[:search])
end
In view:
<%= form_tag quantities_path, :method => 'get' do %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %>
</p>
<% end %>
Now,Above program is only to get report for month.
I am trying to do program like if i enter day or month or year then
also i should get data corresponding day or month or year.
I tried several ways but i am not getting correct one.
Could anyone help in this?
Kind regards.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/c7faa294b06418374d488fee1fc8472b%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.