Displaying 7 results from an estimated 7 matches for "source_type".
Did you mean:
resource_type
2008 Sep 29
1
has_one :through with :source. How to alias association?
...=> ''name must be unique''
validates_presence_of :description, :on => :create, :message => "can''t
be blank"
has_one :attachment, :as => :attachable, :dependent => :destroy
has_one :logo, :through => :attachment, :source => :attachable,
:source_type => ''Maker'', :dependent => :destroy,
:conditions => [''attachments.content_type = ?'',
''image/jpeg'' ]
has_many :products
def deletable?
self.products.empty?
end
end
What I would like to accomplish is to...
2008 Sep 23
2
Contional
...y logic ran along the lines of an ifelse statement and then remove after
that, but it doesn't seem to work? Any help appreciated
Let's call the data test
test$lag <- ifelse(test$user_id==lag(test$user_id)
& test$timestamp==lag(test$timestamp),1,0)
Can anyone help on this?
Mike
Source_type timestamp user_id
75381 0 07-07-2008-21:03:55 848307909687
75379 1 07-07-2008-19:52:55 848307838407
75380 2 07-07-2008-19:54:14 848307838407
75378 1 07-07-2008-15:24:01 848285633277
75374 1 07-07-2008-13:39:17 848273633667
75377...
2009 Apr 12
0
rails 2.3 nested forms with has_many through checkboxes
...#39;'d rather not
have to go to another controller/form just to create and edit page
categories.
class Page < ActiveRecord::Base
has_many :category_items, :as => :item, :dependent => :destroy
has_many :page_categories, :through => :category_items, :source
=> :category, :source_type => "PageCategory", :uniq => true
accepts_nested_attributes_for :page_categories, :allow_destroy =>
true, :reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }
end
class PageCategory < ActiveRecord::Base
has_many :pages, :through => :category_items, :source
=&g...
2005 Dec 31
0
Polymorphic many to many linking
...model class Computer
create table computers (
id serial,
description varchar
);
-- model Class user
create table users (
id serial,
name varchar
);
-- model class Desk
create table desks (
id serial,
location varchar
);
-- The linking table
create table linkings (
source_id int,
source_type varchar,
link_id int,
link_type varchar,
created_at timestamp,
comments varchar
)
I want to use has_many / belongs_to or some other association to be
able to have any number of objects from different types linked to each
object. I don''t want to create multiple linkings tables for...
2009 Dec 15
0
Problems reloading plugin extending AR model
...ired by init.rb of the
plugin):
http://github.com/dedomenon/madb_notifications/blob/master/lib/madb_notifications_lib.rb#L8
Entity.class_eval do
def user_subscribed_to_creation?(user_id)
NotificationSubscription.find(:first, :conditions => [
"source_filter = ? AND event = ? and source_type = ? and
destination_type = ? and destination = ?", {:entity_id =>
self.id}.to_yaml , "after_create", "Instance", "user", user_id.to_s
])
end
end
and this is then used in a view of the plugin, where @entity is an
instance of the model Entity:
http://gith...
2011 Jan 19
6
rake aborted! can't convert Hash into String
Hello,
I encouter a problem when i try to do "rake db:migrate":
rake aborted!
can''t convert Hash into String
Here is the trace result:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
can''t convert Hash into String
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1408:in
2010 Feb 08
5
Why are double sided polymorphic relationships lacking in Rails?
http://stackoverflow.com/questions/2224994/why-are-double-sided-polymorphic-relationships-lacking-in-rails
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to