Displaying 20 results from an estimated 106 matches for "_id".
2006 Apr 27
2
"for column in..." not picking up _id columns
My code executes fully:
<% for column in ModelName.content_columns %>
<th><%= column.human_name %></th>
<% end %>
but it does not pick up any columns in my model''s table that end in
"_id".
Is this by design?
Is there a helper method that will reference the related tables? Or
will I need to code the column titles and detail records by hand?
Learning...
--
Posted via http://www.ruby-forum.com/.
2019 Mar 08
1
syslog / logstah problem with timestamp
Hallo,
I try to send my centos 7 logfiles to an logstsah server.
Can anyone give me an hint how to fix this problem?
Thanks
Ralf
> {"index"=>{"_index"=>"%{[@metadata][comline]}-%{[@metadata][version]}",
> "_type"=>"doc", "_id"=>"U1XLXGkBpfl5FoHeY4J8", "status"=>400,
> "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to
> parse field [timestamp] of type [date]",
> "caused_by"=>{"type&q...
2006 Jun 26
2
DRY up selects in view
Here''s what I''ve got:
<% @fields.each do |field_name| %>
<tr>
<td>
<%= field_name.humanize %>
</td>
<td>
<% unless field_name =~ /_id$/ %>
<%= form.text_field field_name, :size => 40 %>
<% else %>
<%= select(:vendor,
field_name,
State.find(:all, :order => ''name'').collect {|p| [ p.name,
p.id ] },
:selected => @vendor.state.id ) %>...
2006 Jan 03
4
validates_presence_of *_id attributes
Hi all,
I am a newbie to Rails. Please enlighten me on how to do this
appropriately, the Rails and the Ruby way:
Suppose I have a Recipe model. Let''s simplify things and pretend that
it has only 2 attributes, a :name and the other is a ''category_id''. In
the recipes table, category_id is a foreign key to field id of table
categories.
We also assume that I have generate the appropriate scaffolding code
for Recipe and Category. All goes well if I go to
http://localhost:3000/categories (I''m using WEBrick) and add a new
Category...
2006 Jan 18
1
alias for *table*_id
I have a table contacts, in another controller I refer to a particular
contact_id as transfer_attorney_id or electrical_inspector_id - how do I
create the necessary alias in the Contacts model?
2007 Dec 30
6
Restful-Authentication Rspec Failure Rails 2.0.2
I am trying the Restful-Authentication (latest version, downloaded
today) and upon running the generator, doing the migration, prepping
the test system and putting the resources in routes.rb I get a Rspec
test failure:
''SessionsController logins and redirects'' FAILED
expected not nil, got nil
routes.rb has:
map.resources :users
map.resources :sessions
nothing else was
2006 Apr 27
3
Removing a default value for a foreign key with not null set
Hi all,
For various reasons I need to have foreign keys with not null constraints.
Eg:
create_table :people do |t|
t.column :name, :string
t.column :household_id, :integer, :null => false
end
create_table :households do |t|
t.column :name, :string
end
add_foreign_key_constraint :people, :household_id, :households, :id
So the people table has a foreign key into households (household_id), and
not null is enabled on the column.
My problem is...
2007 Jun 09
7
create 2 fk referencing the same table
Hi everyone! I have a problem with defining 2 fk referencing the same
table. I have a Program table and a Team table. The Program should
have an away team and a home team fk. From my understanding, "the fk
column should be named after the class of the target table, converted
to lowercase, with _id appended". But, in my case, I have 2 fk
referencing the same table. How can I do this?
--~--~---------~--~----~------------~-------~--~----~
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 r...
2011 Feb 03
0
Correct way to exclude attributes from json serialization
Hi
I''m using Mongoid and Rails 3, and I want to serialize one of my
mongoid documents to json for publishing via a controller, e.g.
class ReportController < ApplicationController
respond_to :json
def show
report = Report.where(:report_id => params[:id]).first
respond_with report
end
end
This works ok, but pushes out every attribute on the document
including the "internal" mongodb document id, e.g. :
{
_id: 54857324987546, // internal mongoid document id
report_field_a: 1,
report_fiel...
2013 Feb 28
2
Create polymorphic resources
...o
resources :comments
end
A new comment is posted to /foo/1/comments or /bar/1/comments. When I''m in
the Comments#create action, how am I supposed to create the comment through
either Foo/Bar?
If it is a comment for a Foo resource, I need to do:
@commentable = Foo.find(params[:foo_id])
@commentable.comments.create(....)
But if it''s Bar I need to do:
@commentable = Bar.find(params[:bar_id])
@commentable.comments.create(....)
What I do now is to use this method:
def find_commentable
params.each do |name, value|
if name =~ /(.+)_id$/
return $1.classify.cons...
2010 Nov 08
2
[LLVMdev] Creating tablegen patterns for intrinsics with no return value.
...ofile<0, 3, [
SDTCisPtrTy<0>, SDTCisVT<1, i32>, SDTCisVT<2, i32>
]>;
Node:
def atom_g_add_noret : SDNode<"AMDILISD::ATOM_G_ADD_NORET", SDTIL_BinAtomNoRet, [SDNPHasChain]>;
Pattern:
def ATOM_G_ADD_NORET : BinAtomNoRet<IL_OP_UAV_ADD,
"_id($id)", atom_g_add_noret>;
I am Lowering INTRINSIC_W_CHAIN to lower from @llvm.amdil.atomic.add.gi32.noret to the correct instruction with the following code sequence.
LowerINTRINSIC_W_CHAIN(...)
{
...
case AMDILIntrinsic::AMDIL_atomic_add_gu32_noret:
IntNo = AMDILISD::ATOM_G...
2006 Jul 29
9
export to a CSV or XLS file
hello everyone,
Any idea how can i export a resultset from a database to a CSV or XLS
file from the application ? would like the user to have the option to
export selected data to a CSV/XLS file.
Any plugins or libraries avaiable to accomplish this ?
Thanks for your time,
VASU.
--
Posted via http://www.ruby-forum.com/.
2006 Mar 22
3
Something wrong with content_columns
I have a database with a couple of tables. One table called spares has
foreign keys in another called equipment. When I create a new record,
it is added to the spares table however the list action does not show
all the columns in the table. It only shows those columns that are not
foreign keys. I am using the default action generated by scaffold for
list.
Why is that so? Do i need to re-write my
2007 Oct 08
7
belongs_to association doesn't work with _id set
Hello there,
I''m developing an application which has models like this:
class Vehicle < ActiveRecord::Base
belongs_to :internal_dim, :class_name => "Dimension"
def before_create()
idim = Dimension.create
self.internal_dim_id = idim.id
#self.create_internal_dim # Doesn''t work
end
end
class Dimension < ActiveRecord::Base
has_one :vehicle
end
That is, creating the vehicle should create a dimension entry (yeah, i
know it''s strange, but actually dimension table is shared among
differen...
2010 Nov 08
0
[LLVMdev] Creating tablegen patterns for intrinsics with no return value.
...ell the compiler that there's more going on than it can detect just by looking at the inputs and outputs, and so it won't delete the instruction. Something like the following should do the trick:
let hasSideEffects = 1 in
def ATOM_G_ADD_NORET : BinAtomNoRet<IL_OP_UAV_ADD,
"_id($id)", atom_g_add_noret>;
For an existing example, have a look at the memory barrier instruction definitions for the ARM target (DMB and DMB_MCR in ARMInstrInfo.td).
Regards,
Jim
>
> Here is my profile/node/pattern.
> Profile:
> def SDTIL_BinAtomNoRet : SDTypeProfile<0...
2020 Sep 03
2
SID mapping: Samba and SSSD
On 03/09/2020 20:01, Andrew Walker wrote:
> Whoops, fumbled my response a bit. slice size by default is 200,000,
> and to clarify the SID passed into murmur3() is the domain SID, not
> SID?of individual user. Though, manpage for sssd-ad should be
> consulted for precise details. My understanding though is as long as
> everything fits in one slice, then you can just use RID. If
2011 Dec 22
0
mongodb Map/reduce grouping
Hi,
I have two model, challenge(embeds_many :tasks) and task(embedded_in
:challenge),
finally database structue is like this
{ "_id" : ObjectId("4db8b0524f0b495c3a7dbba4"), "title" : "Testing1",
"created" : ISODate("2011-12-12T00:00:00Z"),
"tasks" : [
{
"name" : "task no 1",
"score" : "5&qu...
2010 Nov 08
1
[LLVMdev] Creating tablegen patterns for intrinsics with no return value.
...9;s more going on than it can
> detect just by looking at the inputs and outputs, and so it won't
> delete the instruction. Something like the following should do the
> trick:
> let hasSideEffects = 1 in
> def ATOM_G_ADD_NORET : BinAtomNoRet<IL_OP_UAV_ADD,
> "_id($id)", atom_g_add_noret>;
>
> For an existing example, have a look at the memory barrier instruction
> definitions for the ARM target (DMB and DMB_MCR in ARMInstrInfo.td).
>
> Regards,
> Jim
[Villmow, Micah] Jim, Thanks for the hint, but I tried that and the instructio...
2010 Sep 08
2
subbing a string vector for another string vector
I have a data frame with two columns:
image pattern
1 http://$IMAGE_ID$ www.url.com/image.jpg
2 $IMAGE_ID$ http://www.blah.com/image.gif
...
I want to replace "$IMAGE_ID$" with the corresponding entry in the pattern
column such that the result would appear as follows:
url
http://www.url.com/image.jpg
http://www.blah.com/i...
2006 Jan 25
2
Update join_table attributes
I have two ActiveRecord classes that point at each other with a
"has_and_belongs_to_many" (habtm) relationship using a join table. The
join
table has an a few additional columns besides the _id columns.
For those of you with the Agile Web Dev w/ Rails book, it''s exactly the
same
setup as the articles<->articles_users<->users example on p240.
The habtm relationship is setup fine. I can see the linked data in
instances of the objects.
The problem, though, is that I...