Displaying 20 results from an estimated 600 matches similar to: "ActiveRecord#to_param"
2006 Jul 06
4
update_all Not Incrementing lock_version
Shouldn''t update_all be updating lock_version? As you can see from my
console session below, it is upating the record (changed running
attribute to true and returned 1 to show 1 recored was updated). But it
did not increment lock_version. And optimistic locking is working
correctly otherwise. As you can see below, lock version = 562 before
and after the update_all call but it is
2005 Aug 10
1
Why only a "" string for heading for row.names with write.csv with a matrix?
Consider:
> x <- matrix(1:6, 2,3)
> rownames(x) <- c("ID1", "ID2")
> colnames(x) <- c("Attr1", "Attr2", "Attr3")
> x
Attr1 Attr2 Attr3
ID1 1 3 5
ID2 2 4 6
> write.csv(x,file="x.csv")
"","Attr1","Attr2","Attr3"
"ID1",1,3,5
2010 Jun 01
2
Help on aggregate method
Dear R experts,
I would really appreciate if you had an idea on how to use more
efficiently the aggregate method:
More specifically, I would like to calculate the mean of certain
values on a data frame,? grouped by various attributes, and then
create a new column in the data frame that will have the corresponding
mean for every row. I attach part of my code:
matchMean <-
2013 Feb 25
7
Optimistic Locking Enhancements: Gem or Core?
I''m working on an app that makes use of rails'' optimistic locking feature
and seeing some possibilities for improvements. It seems a bit tedious to
have to add :lock_version to forms wherever the model is used. You also
have to "hack" around rails'' UJS feature to add it as a URL parameter when
using remote: true, method: [:put, :patch, :post, :delete].
2009 Jul 21
2
About Error handler
Hi
I am new to ruby on rails
I need to know one thing
Is there any way to externalize all the error messages in one file and
access
--
Karthik.k
Mobile - +91-9894991640
2010 Jul 02
3
Knowledge discovery
Hi,
I have 100000 units with 10 attributes (attr1, attr2, attr3, etc...)
For instance:
unit attr1 attr2 attr3 ...
1 a ww 12
2 a re 11
3 b ww 09
4 c yt 02
5 a qw 02
...
I'd like to answer to the question:
a) what are the most frequent combinations of attributes?
b) How could I describe the relations
2009 Sep 18
1
inconsistency in attaching attributes to NULL
In R-devel (svn 49628) and back to at least R 2.7.0 we get
inconsistent results when attempting to attach attributes to
a variable with the value NULL.
If we use attributes<- it finishes but changes the value to list().
> a<-NULL
> attributes(a)<-list(attr1="First attribute", attr2=2+2i)
> a
list()
attr(,"attr1")
[1] "First
2006 Feb 23
7
Session Based Record Locking - Solutions?
All,
I''ve written a simple job/opportunity tracking database app via RoR.
I have about 10 internal users.
Sometimes 2 people will want to update the same record at more or less
the same time and they collide.
In particular user 1 may edit a record, then get distracted, and
finally an hour later they click save.
During that hour user 2 may have pulled up the record, edited it, and
2006 Jan 05
2
Confused...
Ok,
So, I''ve got two data tables associated through a foreign key.
class Child < ActiveRecord::Base
belongs_to :parent, :class => Parent, :foreign_key => "parent_id"
# also has attr1, attr2
end
class Parent < ActiveRecord::Base
has_many :children, :class => Child, :foreign_key => "parent_id"
end
So, I''m trying to build the new/edit
2007 Mar 05
1
Deletion of xattr don't sync
Is there option for deleting xattr-s same as --delete for files,
because it seems deletion of xattr don't sync, however it is synced
when data of file change, see example below.
Maybe this is a bug or maybe this is ok?
System gentoo attr-2.4.32, rsync form today cvs.
--
Regards
Stanislaw Gruszka
stasiu@sg /mnt/hda5/export $ echo "data" > file
stasiu@sg /mnt/hda5/export $
2012 Jan 04
1
AR update / create pattern: is there an easier way?
I find myself writing the following frequently:
r = MyActiveRecord.where(:attr1 => cond1, :attr2 => cond2, ...)
r.exists? ? r.first : r.create
... which has the effect of returning an instance of MyActiveRecord if
all the conditions are met, or creating one if it doesn''t. A variant of
this:
c = MyActiveRecord.new(:attr1 => val1, :attr2 => val2, ...)
r =
2008 Oct 21
1
How to force a lock_version increment
Hi everyone,
I have a order with order_lines use case. On changing the lines, I
want to be sure no one else changed the order. So I use lock_version
on the order. This works fine if something is changed on the order
record.
But now i have the situation that I delete, alter and add order lines
without changing the order record itself. I have to check and
increment the order#lock_version however
2006 May 09
7
When to use optimistic locking?
Hi All,
I''m having some trouble deciding when and how to implement optimistic
locking.
Let''s say I have a multiuser Rails app, and let''s say it stores,
among other things "vital" customer information.
The standard methods created by the Rails generate scaffold script
look like this:
def edit
@customer = Customer.find(params[:id])
end
2006 Jan 04
2
Rename lock_version field?
Hi,
Is there a way to tell Rails that the magic field name for optimistic
database locking is not lock_version? I have a legacy database where the
optimistic locking field is named "version".
Thanks,
Phil
--
Posted via http://www.ruby-forum.com/.
2008 Mar 03
2
how can i know type of attribute with active record
Hello,
In my database, I have a table "products" with attributes :
- id
- title ->string
- desc -> text
I use active record, but I don''t know why recover the type of this
attribute with active record?
I try attributes_before_type_cast but I don''t see the type
Can you help me?
Excuse for my english (I''am a young student french)
--
Posted via
2006 Jan 12
9
Scaffold shows all attributes altough I use attr_accessible!
Hi all
I have a Model like this:
class Member < ActiveRecord::Base
attr_accessible :username, :email, :first_name, :last_name
end
I have created a scaffold using script/generate scaffold member members
Using the URL localhost:3000/members/edit/1 I can edit all attributes,
including created_at, lock_version etc.! But it should only show the
attributes I listed in attr_accessible!
What
2012 Nov 12
3
Updating objects in arrays
Perhaps this is a Rails issue. However, I need to first determine whether
I simply am missing something about updating members of an array.
I have an array of 10 ActiveRecord objects. I wish to iterate over the
array and update an attribute. When I do this the underlying table row
changes but the object in the array frequently does not. For example:
count = 0
current_entries.each do
2006 May 27
2
ActiveRecord::Base::find_for_create_modify
Hi,
for some models I found that it''s easier to share the controller new and
update code just to share the view code. At the front of every such
action function I have to lookup if the object already exists, if so
"find" it from the database and update the "attributes=". If there is no
such object, "new" it with the attributes I''ve got from the
2011 Nov 12
1
With an example - Re: rbind.data.frame drops attributes for factor variables
When I use rbind() or rbind.data.frame() to add a row to an existing
dataframe, it appears that attributes for the column of type "factor" are
dropped. See the sample example below to reproduce the problem. Please
suggest How I can fix this.
Thanks,
Sammy
a=c("Male", "Male", "Female", "Male")
b=c(1,2,3,4)
c=c("great", "bad",
2005 Apr 04
10
Encrypted ASP.Net type viewstate
Does rails have any builtin functionality similar to that of ASP.Net''s
encryptable ViewState? For those that don''t know what the ASP.Net viewstate
is, it is essentially just a hidden form field with the name __VIEWSTATE,
that stores a series of encoded(or encrypted) key/value pairs as it''s value.
When the form is submitted the viewstate value is decoded/decrypted on the