Displaying 20 results from an estimated 48 matches for "task_id".
Did you mean:
ask_id
2006 Apr 30
4
Adding values from a db the rails way?
...e''ll be multiple lines for a particular task.
I want to retrieve the total number of hours worked on a task, so that I
can include the information when one views the task details.
I can write a sql query to do this easily enough, like "SELECT
SUM(hours) AS total FROM tasklog WHERE task_id = x", but what''s the
rails way to do this?
thx
n.
--
Posted via http://www.ruby-forum.com/.
2006 May 23
8
ad-hoc query
How do you run an ad-hoc query that does not belong in any model? I
thought it was something like ActiveRecord::connection.find("my
query..."), but I can''t seem to find the documentation on it. I know
I''ve seen it somewhere before, though.
thanks,
Jeff
--
Posted via http://www.ruby-forum.com/.
2008 Apr 23
0
self referential (n-n relationship) belongs many controller
...---------------------------------------------------
model :
class Task < ActiveRecord::Base
belongs_to :statut
has_many :links
has_many :tasklinks , :through => :links
end
---------------------------------------------------------------------------------------
2e table : links
columns : id | task_id | tasklink_id
so in this table, the tasklink_id are the key for the associated tasks
to task_id
---------------------------------------------------------------------------------------
model :
class Link < ActiveRecord::Base
belongs_to :task
belongs_to :tasklink, :class_name => ''Ta...
2006 Aug 09
0
select-multiple for has_many association
I haven''t looked into this for several months, but there still doesn''t
seem to be an obvious way to generate a HTML select element for
choosing multiple items to be set for a has_many association.
<select id="person_task_ids" multiple="multiple"
name="person[tasks][]">
<option value="1">Do something</option>
...
</select>
Let''s see. There''s a handy helper method that results in code like this,
when used straightforwardly
<...
2006 Mar 21
3
Newbie - ActiveRecord relationships
...veRecord::Base
belongs_to :client
belongs_to :user
has_and_belongs_to_many :users
has_and_belongs_to_many :parents,
:class_name => "Task",
:join_table => "parents_task",
:association_foreign_key => "parent_id",
:foreign_key => "task_id"
has_many :logs
has_many :users, :through => :logs
...
My db schema is below. If anyone has some pointers for me I''d REALLY
appreciate it.
Thanks
Nick
CREATE TABLE `tasks` (
`id` int(4) NOT NULL auto_increment,
`parent_id` int(4) default NULL, #Parent task
`title` varc...
2012 Sep 13
3
Creating a link_to from a collection_select
...what is the
current selection of the collection_select. And needless to say I can''t
quite figure it out.
app/views/tasks/show.html.erb
Who would you like to assign this task to?<br />
<%= link_to ''Myself'', :controller => ''task_queues'', :task_id => @task.id,
:action => ''assign_to_me'' %> |
Assign To:
<%= collection_select("assign", "user_id", @users, :id, :full_name )%>
<%= link_to ''Assign'', :controller =>''task_queues'', :task_id => @task.id,...
2006 Jul 16
4
Calculations across multiple tables
...find_by_sql in the past) is get
a sum of the timespan given by ended_at - begun_at for each client.
Is it naive to imagine that AR''s calculations will span relations to provide
a grouped result?
The SQL I''m feeding to find_by_sql comes out something like this:
SELECT client_id, task_id, project_id, clients.client_name,
tasks.description,
time_records.start_at,
(SUM(TIME_TO_SEC(time_records.end_at) -
time_to_sec(time_records.start_at)) / 60) AS total_client_minutes,
(SUM(TIME_TO_SEC(time_records.end_at) -
time_to_sec(time_records.start_at)) / 3600) AS total...
2013 Mar 25
1
validates presence of foreign key fails in nested form
...tr_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 :task_id, :timesheet_id, :time_entries_attributes
validates :task_id, presence: true, uniqueness: { scope: ''timesheet_id''}
belongs_to :timesheet
belongs_to :task
has_many :time_entries, order: :workdate, dependent: :destroy
accepts_nested_attributes_for :time_entries, allow_dest...
2007 Dec 04
10
ActiveRecord::AssociationTypeMismatch
I have the requirement to empty the association records and add the
association records as new (as below).
@task = Task.find(params[:task_id])
@task.task_users = []
params[:ids].split(", ").each do |court_user_id|
task_user = TaskUser.new(:court_user_id => court_user_id)
@task.task_users << task_user
end
@task.save
This is not working. Following error is thrown.
ActiveRecord::AssociationTypeMismatch (Tas...
2018 Oct 16
2
high cpu load with share_conflict on browsing and opening files
...: *
global: struct smbXsrv_open_global0
db_rec : NULL
server_id: struct server_id
pid : 0x0000000000000d16
(3350)
task_id : 0x00000000 (0)
vnn : 0xffffffff
(4294967295)
unique_id : 0x304715b8633d5fa0
(3478773118850129824)
open_global_id : 0xb62ba247 (3056312903)...
2006 Apr 28
5
Newbie: using date-picker
Finally found a nice date chooser script
(http://projects.exactlyoneturtle.com/date_picker), but am a little
confused how to implement it.
So I put this where I need the date picker:
<a id="_name_link" href="#"
onclick="DatePicker.toggleDatePicker(''name'')"
class="demo_link">[ choose date ]</a>
<div
2006 Apr 27
0
last stupid question today
...a predecessor relationship with each
other. My Task class has this:
has_and_belongs_to_many :predecessors,
:class_name => "Task",
:join_table => "predecessor",
:association_foreign_key => "predecessor_id",
:foreign_key => "task_id"
The join table predecessor looks like this:
CREATE TABLE predecessor (
predecessor_id BIGINT NOT NULL,
task_id BIGINT NOT NULL
);
if I create two tasks t1 and t2 and make t2 a predecessor of t1 (like so:
t1.predecessors << t2),
then I can access t2 in memory ala t1.predece...
2008 Feb 19
0
Issue with Observers and has_one association...
...On the other
hand, when I replace the has_one association with just a hand crafted
method, it does get called correctly. So the following does not work:
class Task
has_one :current_instance,
:class_name => ''TaskInstance'',
:foreign_key => ''task_id'',
:order => ''start_at DESC'',
:conditions => ''end_at IS NULL''
but when replaced with the follwoing, it does work.
def current_instance
TaskInstance.find(:first,
:conditions=>"task_id=#{sel...
2010 Jan 22
0
Problem with acts_as_commentable Plugin
...ng to use the acts as commentable Plugin, bit it seems not to
work:
My Commentable Model is the Task Class.
if i try to get the Comments of a Task Object , e.g.
task.find(:first)
task.comments
it occurs this error:
ActiveRecord::StatementInvalid: Mysql::Error: Unknown column
''comments.task_id'' in ''where clause'': SELECT * FROM `comments` WHERE
((`comments`.`task_id` = 4)) ORDER BY created_at ASC
What do i made wrong?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, sen...
2008 Jun 14
0
does BackgrounDRB not "know" the rails environment it is running within/in parallel with?]
...ing the
find/create services of project.rb
invoice.project.delivery_at_date = nil
invoice.project.save
logger.info "Projekt til faktura nr #{invoice.invoice_number}
blev opdateret!"
invoice.save
invoice.invoice_items.each { |ii|
Task.find(ii.task_id).update_attribute( :invoiced_at, DateTime.now)
unless ii.task_id.nil? }
logger.info "Faktura nr #{invoice.invoice_number} blev dannet
med faktura linier!"
else
logger.info "Faktura med ID #{invoice_id} blev ikke dannet -
som PDF!"
end
else...
2008 Sep 06
6
Active record question
...ments made for a particular project. I''m using four models, Projects, Tasks, Resources and Appointments.
The SQL gets me what I''m looking for but how do I do it using Active Record?
Select a.* from appointments a
join resources r on r.id = a.resource_id
join tasks t on t.id = r.task_id
join projects p on p.id = t.project_id
Where project_id = 1;
I can get all the Resources for a project using this but can not get the appointments. I could loop through the resources getting all the appointments and tracking them, but that doesn''t seem like the right way to do it. I cou...
2006 Jul 27
1
Update second pulldown menu based on first menu selection?
I know I''ve seen this somewhere on this board and just can''t search it
anymore.
I have three relational tables: clients, projects, and tasks. Currently
I''m working on customizing the ''new/edit'' task _form. So far I have it
listing clients in a pulldown menu so I can assign the new task to a
client. I''d like to have a second pulldown select
2006 Mar 23
3
drag and drop sorting recipe
The new pragmatic Rails Cookbook has a drag and drop sorting recipe. Does
anyone know if this works with 1.0?
I''ve followed the recipe (i think), and I can drag but when I drop
everything goes back the way it was. It seems that the sort logic doesn''t
get invoked.
I put this code in my view:
<%= sortable_element ''task-list'' ,
:url => {
2010 Aug 21
2
Making a series of similar, but modified .r files - suggested method(s)?
Dear all:
Any suggestions are much appreciated. I am looking for a way to make a
series of similar, but slightly modified, .r files.
My issue is automating making 320 .r files that change the for(i in 1:x) in
my base .r file (as well as other elements, e.g., the load(...),
setwd(...)). For smaller jobs running on a single computer with batch files,
I have been manually changing the for(i in 1:x)
2014 Mar 24
0
Winbind logins failing after upgrade from Samba 3 to Samba 4
...truct messaging_rec
msg_version : 0x00000002 (2)
msg_type : MSG_WINBIND_TRY_TO_GO_ONLINE (1030)
dest: struct server_id
pid : 0x0000000000003f44 (16196)
task_id : 0x00000000 (0)
vnn : 0xffffffff (4294967295)
unique_id : 0x0000000000000000 (0)
src: struct server_id
pid : 0x0000000000003f54 (16212)...