Select_date

actually i have one select_date tag…i choose one date from there.
and then write query related to this…but the query is not run…please
provide some simple code of view and controller.very urgent…

I’ll assume that the date is used to select Info instances based on
their created_on date. In your view you’ll have something like this:

<% form_for :info, :url=>search_infos_path do |f| %>
<%= f.label_for :created_on, “Select info for” %>
<%= f.date_select :created_on %>
<% end %>

In your InfosController:

def search
@infos = Info.find(:all, :conditions=>{:created_on=>params[:info]
[:created_on]}
respond_to do |format|

end
end

On Mar 17, 2:36 pm, Subhadip Chakraborty <rails-mailing-l…@andreas-

On Mar 17, 8:16 pm, AndyV [email protected] wrote:

def search
@infos = Info.find(:all, :conditions=>{:created_on=>params[:info]
[:created_on]}

Not quite select_date (and date_select) both result in 3 separate
parameters being submitted (year/month/day). If you’re passing the
params hash into SomeModel.new or update_attributes (and thus leaning
on the MultiparameterAssignment stuff in rails) you need to pass them
into Date::civil or Time.mktime yourself (I’m pretty sure I’ve written
the exact same post at least twice in the past few days - odd)

Fred

Right again, Fred. I was blowing right by that.

On Mar 17, 7:31 pm, Frederick C. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs