similar to: HABTM Checkboxes - Adding/Updating Users to a Project

Displaying 20 results from an estimated 2000 matches similar to: "HABTM Checkboxes - Adding/Updating Users to a Project"

2006 Jun 15
1
callback object problem
I''m trying to create a separate class to do validation so that about 10 models can use the same date validation. I have tried to use the example from the agile book but it''s not working. Here''s what I have: app/models/date_callbacks.rb class DateCallbacks def before_validation(model) if model.start_date > Date.today model.errors.add(:start_date, "must
2007 Jan 16
1
Can't pass parameters to Ziya controller using url_for
Hi All, I''m stuck yet again. I have an action on a controller that produces a Ziya graph, which I call using the gen_chart() helper. However, I can''t seem to pass more than one parameter through to the action. <%= gen_chart( "overview_graph", url_for( :controller => ''graph'', :action => ''graph'', :graph_id =>
2007 Jul 08
2
datetime_select, is creating an instance of the Time class
Hello It seems that datetime_select, is creating an instance of the Time class. Why would that be? I found this while building a site where people can create vigils (prayer vigils, peace vigils, etc). When I added a validation method that compared start_date to created_at, it generated the error: ArgumentError (comparison of Time with DateTime failed): I was able to put a breakpoint in the
2006 Mar 13
0
Pagination attributes
I have created a pagination with my own conditions : @timesheets_pages = Paginator.new self, count, 30, @params[''page''] @timesheets = Timesheet.find :all,:include =>{:employee=>[:location,:division]}, :conditions => ["employees.location=? and employees.division=? and start_date>? and end_date < ?
2010 Jun 08
2
type conversion with apply or not
Folks, i thought it should be straightforward but after a few hours poking around, I decided it's best to post my question on this list. I have a data frame consisting of a (large) number of date columns, which are read in from a csv file as character string. I want to convert them to Date type. Following is an example, where the first column is of integer type, while the rest are type
2006 Jul 17
1
How to DRY up validates_presence_of
Given the case of validating the presence of an attribute and then performing other tests on said attribute, how do you go about not having to check for nil in the other tests? Example: validates_presence_of :start_date, :end_date validate :validate_start_date_before_end_date def validate_start_date_before_end_date # without this check an exception will be thrown on access to the
2006 Feb 04
0
date_select
Can you see an obvious reason why this date_select code is failing? The parameters from the form - *Parameters*: {"commit"=>"Save All Changes", "campaign_id"=>"1", "campaign"=>{"name"=>"fdsfas", "end_date(3i)"=>"26", "start_date(1i)"=>"2006",
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:
2011 May 30
5
rails habtm checkboxes with jquerymobile
Hi guys, I have a habtm association working properly. My application consists of both a desktop and a mobile version. My mobile version is made with jquerymobile and I would like my checkboxes in the edit form to look like the checkboxes shown in http://jquerymobile.com/demos/1.0a4.1/#docs/forms/forms-checkboxes.html. My desktop code is the following: <%= check_box_tag
2008 Oct 01
0
plotting several yearly/monthly time series on the same plotting several yearly/monthly time series on the same graph
I have searched the forums but I am having trouble trying accomplish two specific plots. I am not sure if this is a very basic task but I am having a lot of trouble Here is my data frame: date prod_daily price 1 2003-08-15 12050 4.83 2 2003-08-18 12050 4.94 3 2004-08-10 12300 5.78 4 2004-08-11 12300 5.64 5 2004-08-12 12300
2009 Sep 19
0
Merging API data and ActiveRecord data for display in the view...
Hi there, I’m trying to merge JSON results from an API call in with ActiveRecord results for a blended display in a view. I’d like to be able to merge the two result sets based on ''created_at'' which is is common in both the ActiveRecord results and the JSON results from the API. Created_at is the only common element between the two data sets. Here’s what I have in my controller
2013 Feb 26
4
3 models, joining and nested queries
I have 3 models, class Host ref: string address: string, name: string primary_key=''ref'' has_many :rooms, :class_name=>"Room", :foreign_key=>''host_ref'' Class Room ref :string host_ref: string capacity: integer primary_key=''ref'' has_many
2006 Jul 11
4
checkboxes with a has_many :through relation
All, I''m populating a view with 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][]",
2008 Nov 11
1
Every other week recurring event
I have the code for computing a weekly event: (start_date..end_date).select{|d| d.wday == wday} but I am wondering if anyone has any ideas for using this to figure out a recurring event for every other week. Is it possible to somehow specify every other within the .select method? Any other implementation ideas? --~--~---------~--~----~------------~-------~--~----~ You received this message
2004 Nov 08
2
Matrix Indexing
Hi, I have the following problem. In a csv file I have under column A, the date, and column B, the prices. Thus, for example, the file looks something like this -> 1/31/04 2.5 2/1/04 2.6 ... 4/12/04 3.5 Basically, I use the function inputframe = read.csv( ) which reads the csv file into the inputframe. My question is, how can I make a function that has, as inputs,
2013 May 27
3
Ransack, acts-as-taggable-on and checkboxes in search form
need some help on ransack filtering. I have model Project, which has many tags through acts_as_taggable gem. Project.rb: class Project < ActiveRecord::Base include PublicActivity::Common belongs_to :customer belongs_to :category has_many :attachments, :as => :attachable has_many :reports, :dependent => :destroy has_many :messages, :dependent
2006 Aug 07
2
Getting an array of ids from form checkboxes?
Is it possible to set up a list of checkboxes so that the form parameters are given in an array (eg {"delete_list" => [3,6,7]}) ? At the moment I''m using <%= check_box_tag "delete_list[#{post.id}]" %> ...which gives parameters looking like {"delete_list" => {"3" => "1", "6" => "1",
2008 Mar 02
2
check_box_tag remote_function
I have a collection of check_box_tags that look like the following: <% for item in @items %> <%= check_box_tag "item[item_ids][]", item.id, false, {:onchange => remote_function(:url => update_items_path, :with => "''items='' + escape(value) "} %> <%= item.name %> <% end %> My question is, how do I send all of the current
2008 Dec 09
4
HABTM checkboxes insert but don't delete
I have a problem related with the HABTM relationships with checkboxes. I''ve got a profile and a service model, both related with has_and_belongs_to_many. The problem is that i can insert new data in the profiles_services table, however, i cant delete already existing data. What could be the problem? --~--~---------~--~----~------------~-------~--~----~ You received this message
2008 Jan 16
4
How to test if one range of dates overlaps another?
Hi all, I have a situation with a recurring billing application where I need to test if one range of dates "overlaps" another range of dates. Does anyone know a rails find or mysql select statement that will test for this? Here are the details: * Recurringcharge items have a start_date and an end_date that represent the period of time that the charges should occur. * Statement items