On 26 February 2012 21:32, Bob Smith wrote:
> Finally found it. Here it is for anyone else in similar trouble.
>
> def add_person
> person = Person.new()
> person.hoh = $hoh
> $hoh = $hoh - 1
> render :update do |page|
> page.insert_html :bottom, 'empty', :partial => 'shared/
> person
On Feb 11, 2:33 pm, Bob Smith wrote:
> On Feb 9, 3:52 am, Peter Vandenabeele wrote:
>
>
>
> > On Thu, Feb 9,2012at 7:07 AM, Hassan Schroeder
> > > wrote:
> > > On Wed, Feb 8,2012at 8:54 PM, Bob Smith wrote:
>
> > > > What I am trying to do is have a *unique value* set in each new record
>
> > >
On Feb 9, 3:52 am, Peter Vandenabeele wrote:
> On Thu, Feb 9, 2012 at 7:07 AM, Hassan Schroeder
> > wrote:
> > On Wed, Feb 8, 2012 at 8:54 PM, Bob Smith wrote:
>
> > > What I am trying to do is have a *unique value* set in each new record
>
> > See:http://rubygems.org/gems/uuid
>
> Indeed.
>
> A
On Thu, Feb 9, 2012 at 7:07 AM, Hassan Schroeder wrote:
> On Wed, Feb 8, 2012 at 8:54 PM, Bob Smith wrote:
>
> > What I am trying to do is have a *unique value* set in each new record
>
> See: http://rubygems.org/gems/uuid
>
Indeed.
And maybe better to not mess with the `def initialize`, but u
On Wed, Feb 8, 2012 at 8:54 PM, Bob Smith wrote:
> What I am trying to do is have a *unique value* set in each new record
See: http://rubygems.org/gems/uuid
HTH!
--
Hassan Schroeder hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
--
You re
On Feb 8, 11:54 pm, Bob Smith wrote:
> On Feb 8, 7:11 am, Peter Vandenabeele wrote:
>
>
>
> > On Wed, Feb 8, 2012 at 10:39 AM, Colin Law wrote:
> > > On 8 February 2012 07:12, Bob Smith wrote:
> > > > I need a way to set a counter that will show how many of the model
> > > > have been created a
On Feb 8, 7:11 am, Peter Vandenabeele wrote:
> On Wed, Feb 8, 2012 at 10:39 AM, Colin Law wrote:
> > On 8 February 2012 07:12, Bob Smith wrote:
> > > I need a way to set a counter that will show how many of the model
> > > have been created and put this in each instance. This will allow me to
>
Ops, sorry...I don't know why I add .all :(
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/eOhjjXJLtU8J.
To post to this group, send email to ru
On 8 February 2012 11:05, grentis wrote:
> ModelName.all.count
Please don't *ever* do this.
If you want a count of all the objects in a table, use
"ModeName.count". Using ".all.count" will instantiate an array of all
of the objects just to do a count of the array... this could be very
slow with
You can use also after_initialize checking if the counter is already setted
after_initialize :set_counter
def set_counter
self.counter ||= ModelName.all.count
end
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To view this discussio
10 matches
Mail list logo