Displaying 20 results from an estimated 1400 matches similar to: "Simple Association"
2011 May 22
6
How to capture correctly a specific exception
I a using delayed_job, and I am raising an exception this way :
config/initializers/custom_exceptions.rb
class RemoteLockerException < StandardError; end
class RemoteLockerDenied < StandardError; end
lib/instruction_request_job.rb
class InstructionRequestJob < Struct.new(:style, :request_id)
def perform
....
> connector =
2007 Apr 30
2
has_many :through polymorphic
Hi All,
I have the following arrangement:
class PickAndPackRequest < ActiveRecord::Base
has_many :transactions, :as => :request
has_many :postings, :through => :transactions
end
class Transaction < ActiveRecord::Base
belongs_to :request, :polymorphic => true
has_many :postings
end
class Posting < ActiveRecord::Base
belongs_to :transaction
end
But when I ask for
2009 Sep 12
3
Need help on Many to Many Relationships
Hi,
Does anyone know where I can find a full step by step tutorial on Many
to Many Relationships with Rails or can describe the steps in
inserting data into the join tables, displaying the connections, etc..
- I don''t only need the model, but all the steps that you would use in
the MVC architecture to make it work.
I am a new to Rails and I cannot find a complete tutorial on all the
2013 Nov 30
1
Need good tutorial on ActiveRecord associations
Hi,
I am very new to rails.. I am having hard times to understand the
ActiveRecord associations.. I tried
http://guides.rubyonrails.org/association_basics.html .. But it is not
for beginners. :)
Is there any good tutorials, to understand the concept?
Thanks
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on
2006 Mar 14
3
ActiveRecord row-by-row processing
I want to use ActiveRecord outside of Rails to do processing on large
tables. I want to be able to process the rows as they are retrieved
rather than having to store the results in an intermediate array.
Any suggestions?
Looks like I could hack the adapter to provide an accessor to the
underlying DBI handle. Anything cleaner than that?
2011 Nov 24
4
How do I destroy all the posts when the board is destroyed?
I got a application like following.
A board has many posts
All posts belong to a board
I try to destroy all the posts under a board when I destroy the board.
My destroy function is following.
def destroy
@board = Board.find(params[:id])
@post = @board.posts
@post.destroy
@board.destroy
respond_to do |format|
format.html { redirect_to(boards_url) }
format.xml
2013 May 22
3
rails 4, active record: appending to has_many :through does not create join model anymore?
hi folks.
on rails 4, can somebody confirm that pushing model instances onto a
has_many :through relation does not create the necessary join model anymore?
class Reader < AR::Base
belongs_to :post
belongs_to :person
end
class Post < AR::Base
has_many :readers
has_many :people, through: :readers
end
@post.people << Person.new
so,
2012 Jun 30
4
find_by_sql and join
hi
I amd tanizawa.
I had problem.
I can not get main.name value from below sql.
"find_by_sql ''select main.id,main.name,sub.name from main left join sub
on sub.id = main.id''"
Please teach me how to get borth name value.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the
2009 May 12
2
STI good or bad for my problem?
Hi. I am currently developing a small course system for student and
teachers. The system is divided in sections and sections have many
messages, comments, documents and schedules. Pretty easy to set up
using ROR, just add some belongs_to and has_many relations. But
everything becomes much more complicated when the section items
(message, comment and so on...) all has comments. And they can also be
2013 Apr 12
5
how to change the date into an interval of date?
Hi,
I am not sure I understand your question correctly.
dat1<- read.table(text="
id??????????? responsed_at???????????????? number_of_connection????????????????? scores
1????????????????? 12-01-2010?????????????????????????????????? 1????????????????????????????????????????????? 2
1????????????????? 15-02-2010??????????????????????????????????
2012 Jun 18
4
Problem with exists? method
Hi,
I have a DB with table TABLENAME, column COLUMN and an active resource
client trying to connect to the DB. When i do
Tablename.find(:all) => i get all the entries from the table
But Tablename.exists?(:column => value) always returns false
I verified that the above command works from rails console. Dont
understand why it always returns false even when there are valid
records.
And in
2007 Mar 25
1
Chan_cellphone and CentOS 4.x
I ran into a problem today while trying to compile chan_cellphone version 17
on a CentOS 4.4 machine. Apparently the bluez and autoconf versions were to
old and as I tried to install the latest version, I found that the new
bluez-lib would install and allow the chan_cellphone to compile, but
bluez-utils required an update to D-sub which in turn required python 2.4 or
better. That apparently in not
2011 Apr 26
2
[LLVMdev] Register pairing in PBQP
Hi.
Im currently investigating LLVM's implementation of PBQP as a part of a
bachelors thesis im doing on register allocation for regular architectures.
In particullar, im looking at the possibility for improving the spill rate
of PBQP for a particular DSP architecture, by using register pairing.
>From reading the source code of lib/CodeGen/RegAllocPBQP.cpp i conclude
that support for
2012 Aug 13
10
Question about PATCH method, accepts_nested_attributes_for, and updates to association lists (has_many, HABTM)
Am interested in the new PATCH method that will be included in Rails 4, but
have a question/concern, and forgive me if I''m misunderstanding it.
So, if the request parameter _method is set to "patch", the update is
processed as a patch.
But, let''s say you have a model called Airplane and Airplane has a
collection of FlightCrewMembers which it
2011 Aug 12
1
Getting nil value when setting an on Join model via a has_many :through relationship
Hi All,
I''ve been trying to figure out what''s wrong here for a little over a
day and figured i''d reach out to the ROR list.
A pastie explains the code a bit better than directly in email:
http://pastie.org/private/mvu0zr1xm18bsk6nfbyama
Basically i have an Artist, and he has many Songs through a join model
called Releases. An artist can be "featured" on a
2008 Oct 22
1
Re: Returning a record's ID before the record is made?!??
In their example,
def create
@product = Product.new(params[:product])
@details = Detail.new(params[:details])
Product.transaction do
@product.save!
@details.product = @product
@details.save!
redirect_to :action => :show, :id => @product
end
rescue ActiveRecord::RecordInvalid => e
@details.valid? # force checking of errors even if products failed
render :action
2009 Feb 21
3
belongs_to or has_many
2 tables Items and Categories
Categories (id, name)
Items (id, name, category_id)
Category_id can be null, and there are Categories that has not an Item.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email
2012 May 27
3
Dumb question
Folks
Can a model just have a belongs_to only? or do you have to have a
belongs_to and a has_many or has_one on the other model?
--
Posted via http://www.ruby-forum.com/.
--
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
2009 Apr 24
1
RoR - getting started with database relations
Hey everyone... I''m just getting my feet wet with relational databases
using RoR models. The software I''m putting together relies on car
parts. Originally I had the database set up as follows
create_table :parts do |t|
t.column :year, :string
t.column :make, :string
t.column :model, :string
.
.
.
end
However, I now realize it''s much better to do it using
2017 Feb 01
0
[PATCH 05/14] netvsc: remove no longer needed receive staging buffers
Since commit aed8c164ca5199 ("Drivers: hv: ring_buffer: count on wrap
around mappings") it is no longer necessary to handle ring wrapping
by having a special receive buffer.
Signed-off-by: Stephen Hemminger <sthemmin at microsoft.com>
---
drivers/net/hyperv/hyperv_net.h | 5 ---
drivers/net/hyperv/netvsc.c | 83 ++++++---------------------------------