similar to: how to have default date for date_select

Displaying 20 results from an estimated 6000 matches similar to: "how to have default date for date_select"

2006 Feb 28
1
Working with date_select ...
I am a little confused about the best way to work with date_select. I see that in my views it generates a simple input form that allows for the entry of year, month and date information. If I just leave it at that, great! But what if now in the controller, I want to work with the date information. I actually want to take the user input date and compute a new date some number of days in the
2006 Jun 12
2
date_select() in collection
Hi, I am doing the following: <% obj.contracts.each do |@contract| -%> ... <%= hidden_field("contract[]", :contractor_id, :index => @contract.contractor.id) %> <%= date_select("contract[]", :starting_on, :index => @contract.contractor.id) %> ... <% end -%> Here are the request parameters: {"commit"=>"Save",
2006 Jul 15
1
Trouble using date_select with blank options
I want to allow users to enter a day and a month, but not necessarily a year. i.e. it should be optional. If I select the day and month, but a blank year and then submit i get: 1 error(s) on assignment of multiparameter attributes The paramaters regarding the date look like this: {"date_of_birth(2i)"=>"3",
2006 Jun 17
2
problem with select_date
In my form I have these items: <%= select_year Date.today, :start_year => Schoolyear.get_startdate.year, :end_year => Schoolyear.get_enddate.year %> <%= select_month Date.today.month %> No matter what I do, in my controller I can''t seem to access the selected year and month. I have tried params[:month].to_s and also
2006 Mar 21
5
Use select_date for my model?
Hi all I have a model "party" that has a time field "starts_at". I have created a form to add new instances of this model. <%= select_date Date.today, :prefix => ''party'' %> Sadly I get the error: NoMethodError in Parties#add undefined method `month='' for #<Party:0x256a600> How can I fix this problem? I remember that I saw in
2006 Jan 07
4
set date with date_select
when retreiving a date from a DATETIME field in a database, is there a way to set the date to the value of the DB in the view? It seems to always default to the current date... if I have a field called birthdate in the users table and i do @user = User.find(@params[:id]) in my view i have a <%= date_select ''birthdate'',''user'' %> but dont know how to
2006 Feb 28
1
RoR date_select() default date
Hi, I''m trying to use the date_select() function of ruby on rails, but I want my form easier to use and I want to put an explicit default date. I don''t kow how to do that. I can''t find any information about default on the web, and no example either. Let me know if there is a tips that I don''t know... -- Posted via http://www.ruby-forum.com/.
2007 Oct 13
5
default date for date_select
Hi, How can I set a default date for a date_select? I''m trying to do something along the lines of: <%= date_select("requirement", "target_date", :end_year => 2020, :discard_day => true, :include_blank => true, :order => [:month, :year], :default => {:month => 10, :year => 2012 }) %> but the default that comes up on the form is blank month
2006 Jul 02
1
DRY? Why select_date and select_date?
Why select_date and select_date? I dont understand why having both (backward compat?). I also look that their source are different, one use the InstanceTag and others calls 3 select_(year, month, day) functions.
2005 Apr 20
1
default date in date_select?
Hi there, I''m new to Rails -- started with this project just about five days ago -- I''m re-building an in-house ordering tool, and it would be handy to pre-populate a date_select field with a value two weeks from now. The calculation isn''t the hard part, it''s getting date_select to pre-populate itself. Any suggestions? Thanks, --Jim
2013 Jan 29
2
Count entries in postgresql grouped by date
Hi! I have a table with visits with a visited_at: attribute which is a datetime field. They seem to be stored as UTC. Now I want to count all visits each day and return something like: { 2013-01-01: 8, 2013-01-02: 4, 2013-01-07: 9, ... } So, I did it like this which kind of works...: def self.total_grouped_by_day(start_date, end_date) visits = where(visited_at:
2008 Oct 31
3
Date_select vs wrong date weird behavior
In my date_select if I choose 31 april 2008, it converts it for 1st may 2008 which it seems odd for me? I say odd because first its difficult to validate at the model level, I have to hook some code in the controller and secondly when I finally get the validation errors I have to go back at the edit page and show the selected date(and the error message) which should be 31 april 2008 but the date
2006 Dec 10
2
set specific date with date_select
Hi All I seem to have a problem with date_select methods. I cannot set a default date. I tried the following: <%= date_select( "post", "written_on", :selected => Date.new(2005,3,31), :order => [:day, :month, :year] ) %> But still I get todays date :( Any suggestions what I do wrong here ? Thnx a lot LuCa -- Posted via http://www.ruby-forum.com/.
2006 Mar 04
5
has_many and belongs_to example?
Hi! If i have 2 tables i.e. product and images and product has_many images, image belongs_to product - how to create _form.rhtml, new/create and edit/update methods in product controller, so in a single form i can add one product and MANY (let''s assume for now that this number is fixed) images for this product? Pleeeeease help me :) -- Posted via http://www.ruby-forum.com/.
2006 Jun 05
1
Format Values from a date_select
Hi I have two date select options in a form, when I try and grab these values using somthing like @pMax = params[:max] I get this in the varibale name max(1i)2006max(2i)6max(3i)5 which has the correct data, jsut with added things like max(1i) Whats the best way of grabbbing this data into a variable without the extra titles? Scott -- Posted via http://www.ruby-forum.com/.
2008 Jun 26
2
Problem with date_select after Rails 2.1 upgrade
Folks, I think I should start a new thread for this, because a similar one I saw is a bit old and the resolution there doesn''t seem to apply to what I''m running into now. Anyway, my date_select calls are bombing on me with the exception: ---- ActionView::TemplateError (wrong number of arguments (3 for 2)) on line #8 of entries/_dates_form.haml: 8: = date_select(
2008 Jun 24
10
Question on passing arguments inside a view.
I''m running into an issue undefined local variable or method `directoryid'' for #<EditorialsController:0x23f1bf8> I have two Models on a legacy database and only one controller called editorials with two actions index and display. I''m trying to pass in a parameter from the results of my search and getting the above error. Example: two tables one is editorial the
2006 Jul 24
1
date_select and ActiveRecord find()
If I pass a date through date_select to a controller, can a Active Record object be found based on this date that is passed? Here is what my log says: ArgumentError (Unknown key(s): publication_date(2i), publication_date(3i), publication_date(1i)): /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/hash/keys.rb:48:in `assert_valid_keys''
2006 Mar 15
1
Strange behaviour of dates
Imagine a crud app that tracks people applying for a loan, here is the layout I have: Mysql database: create table apps ( id int auto_increment primary key, primary_id int not null, secondary_id int null, constraint fk_primary_id foreign key(primary_id) references (contacts.id), constraint fk_secondary_id foreign key(secondary_id) references (contacts.id)) create table contacts ( Id int
2006 Jan 19
2
date_select broken
I am using date_select and in some instances it only shows about 10 years worth of choices. Same form on other users shows the whole range. date_select looks like this <%= date_select ''user'',''birthdate'' , :start_year => 1940 %> I would expect to always see 1940-2006 or so , but i dont always do. Is there a way to force the range or explain why i