Displaying 7 results from an estimated 7 matches for "find_or_create_bi".
Did you mean:
find_or_create_by
2006 Mar 14
7
Single form w/ relationships: how do I integrate it?
OK - I know this has been asked before, but I cannot find it in the
archives. Forgive me if I''m creating more noise than I should.
I want to know the easiest way to deal with this scenario:
I have articles. I have categories for the articles.
On the form where you write an article, there needs to be a free-form
field to entire the category.
The create() method will build the
2006 Mar 14
1
Dynamic Finders with _or_create Don''t Work?
What could cause this?
>> sdfl=PartNumber.find_by_part_number("1111111")
=> #<PartNumber:0xb78fc744 @attributes={"id"=>"11601",
"part_number"=>"1111111"}>
>> sdfl=PartNumber.find_or_create_by_part_number("1111111")
NoMethodError: undefined method `find_or_create_by_part_number'' for
PartNumber:Class
2012 Jun 29
0
Can I make Rails update_attributes with nested form find existing records and add to collections instead of creating new ones?
Hi there,
I''ve asked this question at stackoverflow.com
http://stackoverflow.com/questions/11257662/can-i-make-rails-update-attributes-with-nested-form-find-existing-records-and-ad
I haven''t seen a better answer than one I propose myself but I''d like to
know if it''s possible to enhance accepts_nested_attribute_for to allow a
find_or_create_by behavior for
2006 Oct 21
0
find_or_initialize_by and Nested Resources
Hey guys,
Lets say I have the following nested resources:
map.resource artists do |artists|
map.resource songs
end
To create a new song, the url would be:
/artists/:artist_id/songs/:song_id
However, lets say that an artist doesn''t exist yet. I only want to
create an artist if a new song by the artist is successfully saved. I
am retrieving the artist using something like:
@artist
2011 Feb 24
1
Rails 3 save parent model and association if nested attributes validation fails for uniqueness
Hi,
Song
has_and_belongs_to_many :people
accepts_nested_attributes_for :people
Person
validates :uniqueness => true
If person record not present, nested attributes working great! in rails way.
i.e., inserting into songs, people and people_songs table correctly.
I am interested in:-
*If there is person exist, it should skip insertion into people table but
data should be inserted in songs and
2008 Feb 08
4
x-post : find_or_initialize_by ActiveRecord bug? Ignores :conditions
Hello, I posted this on the rails talk group but received no
response. Perhaps someone on this list could weigh in on whether this
is expected/desired behavior or a bug that I should file and develop
failing tests for
(I doubt I have the active record method_missing fu to actually patch
it).
Test Scenario:
I would like to find or initialize a new user and base the find on the
users email
2013 Feb 18
13
Correct Use or Naming of Migrations
Hi Folks,
There is much discussion where I work at present regarding migrations, and
the ''correct'' usage or not of them.
TL;DR
Should migrations be used just to modify schema, and other ''deploy'' tasks
done other ways? If yes, how to ensure no repeat runs of such tasks
(seeds, jobs etc)
Background
Once you''re live there are often additional things