Re: [Rails] Re: Best way to create an endless Background job?

2011-08-15 Thread Jim Ruther Nill
On Tue, Aug 16, 2011 at 9:42 AM, 7stud -- wrote: > Jim ruther Nill wrote in post #1016826: > > Everytime the page loads > > The user could have the page open for two hours. What then? > > After the js fires, set that same script to run after 1 hour. > -- > Posted via http://www.ruby-forum.com/

[Rails] Re: how to get list of Active record fields in database order ?

2011-08-15 Thread 7stud --
Jedrin wrote in post #1016808: > If rec is an active record object and you call rec.attribute_names, it > gives you the field names in alphabetical order. > If there is a way to get the order that the fields where created into > the dabatase on the create_table sql call, I would find that very > u

[Rails] Re: JQuery dialog not works

2011-08-15 Thread 7stud --
http://jqueryui.com/demos/dialog/#option-autoOpen -- 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@googlegroups.com. To unsubscribe from this

Re: [Rails] JQuery dialog not works

2011-08-15 Thread Bruno Santos
Try autoOpen: true Or create a link that starts the dialog For example: $("a.new_dialog).click(){ $("#test").dialog("open"); } 2011/8/15 Bruno Meira > Hi guys, > I installed JQuery on my rails application, I tested some functions > like $("#some_elem").attr("id"), and it works wel

[Rails] JQuery dialog not works

2011-08-15 Thread Bruno Meira
Hi guys, I installed JQuery on my rails application, I tested some functions like $("#some_elem").attr("id"), and it works well. So, I think that my file was corrected installed. My problem is this: - Everytime that I use JQuery command to create I dialog, this command doesn't works. One example is

[Rails] Re: Best way to create an endless Background job?

2011-08-15 Thread 7stud --
Jim ruther Nill wrote in post #1016826: > Everytime the page loads The user could have the page open for two hours. What then? -- 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 g

Re: [Rails] Best way to create an endless Background job?

2011-08-15 Thread Jim Ruther Nill
On Tue, Aug 16, 2011 at 7:09 AM, Genji wrote: > Hello there, > > I'm still "new" to ruby on rails, i try to create a little > browsergame. For that, I have to control the "resources" of a village. > For example: > The village got a wood rate of 200 per hour, so i want to call every > hour a metho

[Rails] Re: newbie: before_create :setuniqueno

2011-08-15 Thread 7stud --
Tom Tom wrote in post #1016803: > in terms of an invoice i would eg like to display a uniqe number. yes > , i could use auto-inc, which is the internal id, but sometimes u just > need a ssecond one. > so i was wondering how i would generate that during eg a create action. > If you use the internal

[Rails] Re: Best way to create an endless Background job?

2011-08-15 Thread 7stud --
Genji wrote in post #1016820: > Hello there, > > I'm still "new" to ruby on rails, i try to create a little > browsergame. For that, I have to control the "resources" of a village. > For example: > The village got a wood rate of 200 per hour, so i want to call every > hour a method/action (anything

[Rails] Best way to create an endless Background job?

2011-08-15 Thread Genji
Hello there, I'm still "new" to ruby on rails, i try to create a little browsergame. For that, I have to control the "resources" of a village. For example: The village got a wood rate of 200 per hour, so i want to call every hour a method/action (anything) that count the 200 to the rest wood. But

[Rails] Re: Change_column Oracle index limit

2011-08-15 Thread theLemcke
You know what? Nevermind. Turns out that table is deleted later in my migrations, so I'll just comment this line out. Still would like to know how to do this, if it's even possible. On Aug 15, 3:17 pm, Hassan Schroeder wrote: > On Mon, Aug 15, 2011 at 3:06 PM, theLemcke wrote: > > Yes, but how

[Rails] Re: how to get list of Active record fields in database order ?

2011-08-15 Thread Jedrin
I wrote this for now, a terrible hack def get_order str = self.inspect ar = str.split(',') ar[0] = ar[0].gsub(/^\S*/,'') ar[ar.length - 1] = ar.last.chop puts 'ar' p ar ar2 = ar.map{|el| el.split(":")[0].strip} puts 'ar2' p ar2 del_idxs = [] ar2.each_

Re: [Rails] Re: Change_column Oracle index limit

2011-08-15 Thread Hassan Schroeder
On Mon, Aug 15, 2011 at 3:06 PM, theLemcke wrote: > Yes, but how do I do this with change_column? No idea, and I doubt you can :-) Can you post the migration itself and the current schema for the table? -- Hassan Schroeder hassan.schroe...@gmail.com http://about.me/has

[Rails] Re: Change_column Oracle index limit

2011-08-15 Thread theLemcke
Yes, but how do I do this with change_column? On Aug 15, 1:53 pm, Hassan Schroeder wrote: > On Mon, Aug 15, 2011 at 1:41 PM, theLemcke wrote: > > Index name > > 'temp_index_altered_comments_on_commentable_id_and_commentable_type' > > on table 'altered_comments' is too long; the limit is 64 chara

[Rails] Re: Puzzled with form on multiple table rows

2011-08-15 Thread Michael Baldock
@Walter Actually the form being submitted is going through EventsController, the table of events is just the events/index, and I've made a new route called events/multi_params_edit, which is where the form submits to. So the EventsController is trying to update lots of events, not an associate

Re: [Rails] newbie: before_create :setuniqueno

2011-08-15 Thread Hassan Schroeder
On Mon, Aug 15, 2011 at 2:04 PM, tom wrote: > @why > sometimes u just need to display another e 10digits number which u can > trace back and is still unique > @how > still not sure if a loop is the right way You can just try to save and be prepared to catch the validation failure, which will requ

[Rails] how to get list of Active record fields in database order ?

2011-08-15 Thread Jedrin
If rec is an active record object and you call rec.attribute_names, it gives you the field names in alphabetical order. If there is a way to get the order that the fields where created into the dabatase on the create_table sql call, I would find that very useful. It seems like there is supposed

[Rails] Re: Can't force scaffold to overwrite files?

2011-08-15 Thread Markham A.
Use "script/destroy scaffold client admin" If you can create it with 'script/generate', you should be able to destroy it with 'script/destroy'. However, there's an inherent inconvenience if you use this with an entity that creates a migration (e.g. model, scaffold). Once you rake the migration

Re: [Rails] newbie: before_create :setuniqueno

2011-08-15 Thread tom
i know uuid etc. @why sometimes u just need to display another e 10digits number which u can trace back and is still unique @how still not sure if a loop is the right way On Mon, Aug 15, 2011 at 4:59 PM, Hassan Schroeder wrote: > On Mon, Aug 15, 2011 at 1:52 PM, tom wrote: >> in terms of an inv

Re: [Rails] newbie: before_create :setuniqueno

2011-08-15 Thread Hassan Schroeder
On Mon, Aug 15, 2011 at 1:52 PM, tom wrote: > in terms of an invoice i would eg like to display a uniqe number. yes > , i could use auto-inc, which is the internal id, but sometimes u just > need a ssecond one. Still not sure why, but OK -- google `ruby UUID` :-) - Hassan Schroeder

Re: [Rails] Change_column Oracle index limit

2011-08-15 Thread Hassan Schroeder
On Mon, Aug 15, 2011 at 1:41 PM, theLemcke wrote: > Index name > 'temp_index_altered_comments_on_commentable_id_and_commentable_type' > on table 'altered_comments' is too long; the limit is 64 characters > > How do I specify the name of the temporary index in the migration? e.g. add_index :thin

Re: [Rails] newbie: before_create :setuniqueno

2011-08-15 Thread tom
in terms of an invoice i would eg like to display a uniqe number. yes , i could use auto-inc, which is the internal id, but sometimes u just need a ssecond one. so i was wondering how i would generate that during eg a create action. On Mon, Aug 15, 2011 at 4:49 PM, Hassan Schroeder wrote: > On Mo

Re: [Rails] newbie: before_create :setuniqueno

2011-08-15 Thread Hassan Schroeder
On Mon, Aug 15, 2011 at 12:57 PM, tom wrote: > class Invoice < ActiveRecord::Base > before_create :setuniqueno > validates_uniqueness_of :uniquenumber > def setuniqueno >        self.uniquenumber = Time.now.to_i > end > end > after the user post to the create function i also create an Invoice. >

[Rails] Change_column Oracle index limit

2011-08-15 Thread theLemcke
I'm trying to execute a simply change_column on oracle, with the following output: -- change_column(:comments, :text, :string, {:limit=>1000}) rake aborted! An error has occurred, this and all later migrations canceled: Index name 'temp_index_altered_comments_on_commentable_id_and_commentable_type

Re: [Rails] newbie: before_create :setuniqueno

2011-08-15 Thread tom
hi philip so i should use a loop while !@invoice.valid? in the task create action(until its valid?)? thx On Mon, Aug 15, 2011 at 4:29 PM, Philip Hallstrom wrote: >> i was wondering how this should be handled.imagine i have this class: >> >> class Invoice < ActiveRecord::Base >> before_create :s

Re: [Rails] newbie: before_create :setuniqueno

2011-08-15 Thread Philip Hallstrom
> i was wondering how this should be handled.imagine i have this class: > > class Invoice < ActiveRecord::Base > before_create :setuniqueno > validates_uniqueness_of :uniquenumber > def setuniqueno > self.uniquenumber = Time.now.to_i > end > end > ## > class Task end > ## > after the

[Rails] Re: respond_with with templates and http status when creating an object

2011-08-15 Thread Michel Pigassou
I was able to perform what I'm talking about in an initializer, maybe it can help seeing the big picture: ```ruby ActionController::Responder.class_eval do def to_format if has_errors? api_behavior(nil) and return end controller.response.status = :created if post? && ! has_er

[Rails] newbie: before_create :setuniqueno

2011-08-15 Thread tom
hi, i was wondering how this should be handled.imagine i have this class: class Invoice < ActiveRecord::Base before_create :setuniqueno validates_uniqueness_of :uniquenumber def setuniqueno self.uniquenumber = Time.now.to_i end end ## class Taskhttp://groups.google.com/group/rubyonrai

[Rails] gmaps4rails

2011-08-15 Thread bertly_the_coder
Hi guys, I'm trying to use longitude and latitude to center a map like so: <%= gmaps("map_options" => { "auto_zoom" => true, "center_latitude" => 40.7275043, "center_longitude" => -73.9800645},"markers" => { "data" => @json}) %> I have tried several variations of the line above, but none of them

Re: [Rails] Re: Long polling (comet) on Rails

2011-08-15 Thread Jeffrey L. Taylor
Quoting Yaroslav Govorunov : > On Aug 14, 1:52 pm, Frederick Cheung > wrote: > > On Aug 11, 12:27 pm, "Yaroslav G." wrote: [snip] > Spreading nodes completely depends on a backend used to store and pass > messages - whether it would be RabbitMQ, database, etc. We only added > non blocking eventma

[Rails] respond_with with templates and http status when creating an object

2011-08-15 Thread Michel Pigassou
Hi. When you use respond_with in a controller #create method and want to render XML the response gets the http status 201 (Created). But if you use a view to render this XML response_with uses the status 200 (Ok), for example when you use the gem rabl. I cannot determine if this matter is relat

[Rails] Rails 3.1 Where to put some application.coffee code ? file tree

2011-08-15 Thread Erwin
In 3.0 we are using an application.coffee file and some specific controllers .coffee files using the following file tree - app - coffescripts > application.coffee - controllers > control1.coffee > control2.coffee In 3.1 , I wonder where I should p

[Rails] Re: Rackspace, Engine Yard, Heroku, etc. - Which do you recommend?

2011-08-15 Thread Mike C.
There is a little company called Webappcabaret.com that specializes in PAAS. You may give them a try. They use the same cloud infrastructure as the others you mentioned, but I think their PAAS platform is far superior. Ben Knight wrote in post #1016745: > Hello. > > We are looking for a new prov

[Rails] How can a User delete another User? | Devise + CanCan

2011-08-15 Thread David Sousa
Hi there, I'm using Devise and CanCan. All my users will be created and manage through my Admin::UsersController by a User that has a Role of "Admin". Devise will not register or unregister a User. Every time that a log_in "Admin" User, that was authenticated ( before_filter :authenticate_user! )

[Rails] Re: Delayed_Job: code working fine without .delay / with .delay it fails. Why?

2011-08-15 Thread Genji
On 15 Aug., 14:19, Frederick Cheung wrote: > On Aug 15, 1:10 pm, Genji wrote: > Well the problem WAS that it didn't do anything, the worker just told me: [Worker(host:Sascha-Gundels-MacBook-Pro.local pid:961)] 2 jobs processed at 96.8147 j/s, 2 failed ... But it changed now. All I did was se

[Rails] Re: Delayed_Job: code working fine without .delay / with .delay it fails. Why?

2011-08-15 Thread Frederick Cheung
On Aug 15, 1:10 pm, Genji wrote: > Hi all, > > I wrote a simple code to set up the "pit_id" from a village table from > 1 to 2, from 2 to 3 and so on. > It works fine without .delay . But i need it so whats wrong with that > code? > > #village_controller >   def post_info >     @village = Villag

[Rails] Rackspace, Engine Yard, Heroku, etc. - Which do you recommend?

2011-08-15 Thread Ben Knight
Hello. We are looking for a new provider to host our Rails site -- we have outgrown our current provider (for the past 4 years) since our business is beginning to take off in a big way this year. Which provider (e.g. Rackspace, Engine Yard, Heroku, Serverbeach, etc.) would you recommend to run a

[Rails] Delayed_Job: code working fine without .delay / with .delay it fails. Why?

2011-08-15 Thread Genji
Hi all, I wrote a simple code to set up the "pit_id" from a village table from 1 to 2, from 2 to 3 and so on. It works fine without .delay . But i need it so whats wrong with that code? #village_controller def post_info @village = Village.find(params[:id]) @village.delay.upgrade fla

[Rails] Asset Pipeline pre-processing doesn't clear the cache when dynamic erb is used

2011-08-15 Thread overture
Pre-processing in development mode caches after the first call - which is usually fine - however, when using an erb template with potentially dynamic output, the cache doesn't clear. For example, if I have a javascript file in the asset pipeline called "time.js.erb", which outputs an alert with li

[Rails] Re: RegExp error:

2011-08-15 Thread Misha Ognev
Dheeraj Kumar, it works, thanks! -- 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@googlegroups.com. To unsubscribe from this group, send emai

Re: [Rails] Re: sessions store

2011-08-15 Thread Peter De Berdt
On 15 Aug 2011, at 11:54, Frederick Cheung wrote: On Aug 13, 10:59 pm, "Tomas R." wrote: i have some questions about sessions store, actually im using cookie based authentication. But i need a way to know if someone is logged in or not, so that's why i need DB store sessions, but my questio

[Rails] Re: sessions store

2011-08-15 Thread Frederick Cheung
On Aug 13, 10:59 pm, "Tomas R." wrote: > i have some questions about sessions store, actually im using cookie > based authentication. But i need a way to know if someone is logged in > or not, so that's why i need DB store sessions, but my question is, is > the a way of making this sessions expi

[Rails] Re: RegExp error:

2011-08-15 Thread Misha Ognev
> ^[1-9]\d*$ Walter, thanks for this. > Is this column an integer column? If so, then I seem to recall that at > the point that validations run rails has already converted the > argument to an integer, i.e. it will have converted your 123f to 123 > and so your validation passes. Fred, how I can fi

Re: [Rails] Re: RegExp error:

2011-08-15 Thread Dheeraj Kumar
Agreed. @OP: You should try this instead: http://edgeguides.rubyonrails.org/active_record_validations_callbacks.html#numericality On Mon, Aug 15, 2011 at 2:41 PM, Frederick Cheung < frederick.che...@gmail.com> wrote: > > > On Aug 14, 7:29 pm, Misha Ognev wrote: > > Hi! This problem(in model):

[Rails] Re: Puzzled with form on multiple table rows

2011-08-15 Thread Frederick Cheung
On Aug 14, 7:58 pm, Michael Baldock wrote: > I've got a table of events, and each event has a boolean attribute > is_ten_event. > > On each row of the table is a chekbox to edit the value of is_ten_event, > so that multiple rows can be edited with one submit. > > In order to allow boxes to be un-c

[Rails] Re: RegExp error:

2011-08-15 Thread Frederick Cheung
On Aug 14, 7:29 pm, Misha Ognev wrote: > Hi! This problem(in model): > > validates :some_digits_collection, :presence => true, :format => { :with > => /^\d*$/, :message => "Must contain only digits!" } > > So, :some_digits_collection must match only digits. But when I puts > "123f"(for example)

[Rails] Railskit

2011-08-15 Thread MC
Anyone on the list using the current version of Railskit? -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-t