Displaying 13 results from an estimated 13 matches similar to: "nested forms: use validate :some_method works in update mode only"
2013 Mar 30
1
How to use group in nested associations
The below query fails:
Timesheet.joins(:time_entries).select("timesheets.*,
sum(time_entries.worktime) as total").group("timesheets.start_date")
The models have the following relations:
Timesheet < AR
has_many :activities, dependent: :destroy, inverse_of: :timesheet
has_many :time_entries, through: :activities
accepts_nested_attributes_for :activities,
2013 Mar 04
0
fields_for with accepts_nested_attributes: how to pass a value to a label
I can''t figure out how to pass a value from the following object build in
the controller:
class TimesheetsController < AC
...
def new
@timesheet = current_user.timesheets.new
now = Date.today
#generating 7 time entries: monday through sunday
(now.beginning_of_week..now.end_of_week).step { |date|
@timesheet.time_entries.build(:workdate; date)
end
end
...
In the
2013 Mar 04
2
accepts_nested_attributes: undefined method 'association'_attributes
I have 2 models Timesheet and TimeEntry:
class Timesheet < ActiveRecord::Base
attr_accessible :status, :user_id, :time_entries_attributes
has_many :time_entries, dependent: :destroy
accepts_nested_attributes_for :time_entries, :reject_if => proc {
|attributes| attributes[''worktime''].blank? }
end
class TimeEntry < ActiveRecord::Base
attr_accessible :task_id,
2013 Mar 25
1
validates presence of foreign key fails in nested form
I''m using accepts_nested_attributes as follows:
class Timesheet < ActiveRecord::Base
attr_accessible :status, :user_id, :start_date, :end_date,
:activities_attributes
has_many :activities, dependent: :destroy
has_many :time_entries, through: :activities
accepts_nested_attributes_for :activities, allow_destroy: true
end
class Activity < ActiveRecord::Base
attr_accessible
2005 Sep 28
0
search engine, select the selected option
hey, i have a search engine that let u search on the an employee
how can i make that if the user select "employee1" , on the next page
"employee1" is selected
this is my code (rhtml)
<tr>
<td><label for="employee_id">Employee</label></td>
<td colspan="3"><%= select "employee", "id",
2006 Jan 28
0
calling javascript via "eval(request.resopnseText") help needed.
I have a link_to_remote method:
<%= link_to_remote image_tag("clock_run.gif", :border=>''0''),
:update => @task.id,
:complete=>"eval(request.responseText);",
:url => {:controller => ''time_entries'',
:action => ''punch_in'',
:id => @task} %>
The controller
2007 Aug 04
2
Problems using "lm" in combination with "predict"
Hello everybody,
I'm trying to predict a linear regression model but it does not work.
My Model: y = Worktime + Vacation + Illnes + Bankholidays
My modelmatrix is of dimension 28x4
Then I want to make use of the function predict because there confidence.intervals are include.
My idea was:
mod <- lm(y~Worktime+Vacation+Illnes+Bankholidays)
newdate=data.frame(x=c(324,123,0.9,0.1))
2000 Jun 16
0
Any suggestion?
Hi,
In R-Notes there is the open.account example which is partly kind of what
I'd like to do. I would like to add the following properties or
capabilities:
- I'd like to add persistence to the object.
- I'd like to keep an history of all operation done on an account.
- I'd like to add the possibility of transfer between accounts and apply
the concept of transactions.
2006 Nov 04
0
Controller don''t receives form parameters using form_remote_for
Hi.
I''m having a problem that I am sure there is a simple solution for, but
I can''t see it.
I have the following partial:
<% form_for :time_entry, TimeEntry.new,
:url => hash_for_time_entries_url(:period => @period, :action => ''new''),
:html => { :id => ''time-entry-form'' } do |f| %>
<table border="0"
2006 Sep 20
2
Not receiving form data using form_remote_for
Hi.
I''m having a problem that I am sure there is a simple solution for, but
I can''t see it.
I have the following partial:
<% form_for :time_entry, TimeEntry.new,
:url => hash_for_time_entries_url(:period => @period, :action =>
''new''),
:html => { :id => ''time-entry-form'' } do |f| %>
<table border="0"
2015 Dec 10
0
Authentication to Secondary Domain Controller initially fails when PDC is offline
Hmm..
> >>>> Could this have to do with...
> >>>> a) I demoted my initial 1st DC (seized FSMO roles) and got rid of
> >>>> DNS entries via this script on the wiki?
> >>>> b) set up the *new* 2nd DC on the hardware of the prior 1st DC
> >>>> (with the same IP address)?
This can be a problem yes, depending on the order of
2015 Dec 11
2
Authentication to Secondary Domain Controller initially fails when PDC is offline
Hi Ole,
Using internal DNS samba_dnsupdate does not work correctly, at least not
every time.
Someone modified this samba_dnsupdate tool commenting this line:
os.unlink(tmpfile)
which should line 413.
Doing that he was able to get files generated by samba_dnsupdate to use
them as argument of nsupdate command (without -g switch and with "allow dns
updates = nonsecure" in smb.conf).
I
2012 Mar 08
18
some fixes, improvements, and new features (EPO and DYING) for NUT
Here are a series of my recent changes to NUT.
The first few in the set are primarily little fixes and improvements.
In among those are a few for .gitignore files which of course you can
ignore for SVN, and there's one for a commit to a generated file which
of course should not be tracked in any VCS.
Then there are a couple or three to do with generating the header files
used by