search for: current_job

Displaying 10 results from an estimated 10 matches for "current_job".

2006 Jul 06
3
Understanding date_select naming conventions
I am using the date_select helper to generate date select elements in a form. I notice that the generated HTML shows that these selects have the following names: Month: current_job[StartDate(2i)] Day: current_job[StartDate(3i)] Year: current_job[StartDate(1i)] I''m assuming that the Xi identifiers somehow specify the appropriate date part from a date or time value. Can anyone shed some light on how this works? Where can I get definite info. on it? Also, I am...
2006 Jul 11
4
checkboxes with a has_many :through relation
...th checkboxes in a list. I want to be able to assign to my has_many relationship using the post values of these checkboxes. Essentially, I want to populate the relationship table which will create the correct join values in my model. Here is my check_box_tag code: <%= check_box_tag("@current_job[target_list_ids][]", tlist.DataSetID, @current_job.target_lists.include?(tlist)) %> So, in this example, tlist is an element of another array that I''m starting with to give me the list of choices. But what I want is to assign these choices...
2006 Jul 18
1
Auto-populating time portion of a datetime field from a form
I see that if I use the date_select helper in my view, then in the generated page, my selects are named obj[datetime_field(1i)] (and 2i and 3i for the other parts). These auto-populate the date portion of my datetime_field. I have another datetime field that I''m presenting the time from and I would like to use a similar scheme to autopopulate it. Currently, I''ve used the
2006 Jul 06
4
ERb question: Embedding <%= %> in helper method calls
I had a situation where I wanted to use a <%= %> (scriptlet) in my text_field call to set the "disabled" attribute on the text field, like so: <%= text_field(:current_job, ''removeLinkPos'', :value => '''', :id => ''offset'', :maxlength => 2, :disabled => <%= sometest ? ''true'' : ''false'' %>) %> however, this caused a compile error. I ended up with an if/else s...
2008 Mar 19
5
object_transactions plugin w/2.x disables AR session store
All, Win XP Rails 2.0.2 object_transactions plugin (http://code.bitsweat.net/svn/object_transactions/) transaction-simple gem 1.4 (required by object_transactions plugin) AR SQL Server Adapter 1.0 SQL Server 2000 Using the object_transactions plugin with Rails 2.0.2 (and I assume based on what I''m seeing that this goes for Rails 2.x) disables the ability to save to an ActiveRecord based
2006 Jul 12
0
Give form elements "fieldWithErrors" class in non-std. way?
...e an element of my model to be invalid, but not generate any message for it, so that the corresponding form field on a form will show up with the ''fieldWithErrors'' class. I have some checkboxes on my RHTML form, and they are generated with this code <%= check_box_tag("current_job[target_list_ids][]"...etc. %> target_list_ids is an attr_accessor attribute and does not exist in the backing table for my model. If none of these checkboxes are checked when the form is submitted, the validate method puts up a message complaining. That''s fine. But I also wan...
2006 Jul 13
4
Does text_field go directly to attributes hash in AR object?
...ield to call the appropriate method on my object. So here''s my getter: public def FAX fax = read_attribute(:FAX) puts fax sprintf("(%d)%d-%d", fax[0,3], fax[3,3], fax[6,4]) "crap" end Here''s a snippet of my template: <TD><%= @current_job.FAX %><%= text_field(:current_job, ''FAX'') %></TD> Fax: crap[text field with numbers in it - the value of the call to read_attribute] So my question is: QUESTION: Does text_field(:object, :method) call object.read_attribute(method) or object.method If it calls...
2006 Jul 14
7
Form validation - keepin correct fields displayed on refresh
All, I''m finally doing my first real form in Rails - the model object that I''m entering information for has 8 validations so far. If I type in good values for all the fields but one, I get the pretty validation, and the nice field highlighting, but all of the fields are cleared, forcing me to retype all of that info. That is a big drag. Is there a standard way to get the
2006 Jul 06
2
Custom init. of ActiveRecord objects - best practices
All, I''m wanting to initialize an ActiveRecord object. I understand that there is a method called after_initialize that appears to get called right after the ActiveRecord object is instantiated. Is after_initialize a Ruby thing or a Rails thing? Where is after_initialize documented? Can I pass parameters to it? If so, how? I want to initialize the "belongs_to" attribute of
2006 Jul 10
10
has_many :through and foreign key parameters
I just took my HABTM and turned it into a :through since my join table has another "non-joiny" attribute. I went from this: has_many_and_belongs_to :jobs, :join_table => ''tablename'', :foreign_key => ''x'', :association_foreign_key => ''y'' to this: has_many :jobs, :through =>