[Rails] Re: when migrating add_index error: invalid date

2011-02-11 Thread Nikos Dimitrakopoulos
Replace mysql2 gem with mysql (at least for development mode under windows). Solved here : https://groups.google.com/d/msg/rubyonrails-talk/a-wyECimZ5g/1F0sgAcje0cJ -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group,

[Rails] Hbar color - openflash chart

2011-02-11 Thread Jeffrey Bonson
Hi, am using Openflashchart plugin,How can we change the color of each bar in Hbar openflash chart this is the code i have inside my controller def stat_bar title = Title.new(session[:tag]) hbar = HBar.new hbar.values = [HBarValue.new(0,10),HBarValue.new(0,20)] hbar.colour =

Re: [Rails] Weird form behavior

2011-02-11 Thread Tim Uckun
On Fri, Feb 11, 2011 at 4:40 PM, Tim Uckun timuc...@gmail.com wrote: On Fri, Feb 11, 2011 at 4:38 PM, Jim Ruther Nill jvn...@gmail.com wrote: I'm not sure but if you look at http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html your params does not have the same

Re: [Rails] Re: Like gsub but the parameter is matchdata

2011-02-11 Thread Jatin kumar
On Fri, Feb 11, 2011 at 8:02 AM, Ralph Shnelvar li...@ruby-forum.comwrote: Check this out. http://www.ruby-doc.org/core/classes/String.html#M001186 I must be blind. I see no MatchData anywhere. I see *match* which is a string ... but no MatchData. What exactly do you mean when you say

[Rails] Get request by session id?

2011-02-11 Thread Hans Hartmann
Hello, i've stored my sessions in a session table and can acces them via: Session.all (id, session_id, data, c_at, u_at) also i can get my current session_id via: request.session_options[:id] Is there a possibility to find all request containing to every single session - to get an overview

[Rails] Re: Get request by session id?

2011-02-11 Thread Frederick Cheung
On Feb 11, 10:55 am, Hans Hartmann li...@ruby-forum.com wrote: Hello, i've stored my sessions in a session table and can acces them via: Session.all (id, session_id, data, c_at, u_at) also i can get my current session_id via: request.session_options[:id] Is there a possibility to find

[Rails] Re: Get request by session id?

2011-02-11 Thread Hans Hartmann
I'm not sure what you're after - requests aren't persisted anywhere (unless you're doing something special to do that) I want to find a possibility to get the PATH_INFO of each session user. My first opinion to do that was to list the env of all sessions. The reason I want to do that is to

Re: [Rails] Weird form behavior

2011-02-11 Thread Jim Ruther Nill
oh right! we forgot about that one when we were discussing it minutes ago. :D at least you figured it out. On Fri, Feb 11, 2011 at 6:05 PM, Tim Uckun timuc...@gmail.com wrote: On Fri, Feb 11, 2011 at 4:40 PM, Tim Uckun timuc...@gmail.com wrote: On Fri, Feb 11, 2011 at 4:38 PM, Jim Ruther Nill

Re: [Rails] Re: Like gsub but the parameter is matchdata

2011-02-11 Thread Jim Ruther Nill
i think what he meant was like the scan function for string but instead of returning String objects, you get MatchData objects. On Fri, Feb 11, 2011 at 6:26 PM, Jatin kumar jatinkumar.n...@gmail.comwrote: On Fri, Feb 11, 2011 at 8:02 AM, Ralph Shnelvar li...@ruby-forum.comwrote: Check this

Re: [Rails] Map integration with showing places within the particular radius

2011-02-11 Thread Peter Bell
And the geokit-rails3 gem which adds basic finders by distance. It's not a completely functional port of the old geokit-rails because of all the changes in Rails3, but the basic distance finders work just fine. https://github.com/jlecour/geokit-rails3 Best Wishes, Peter On Feb 11, 2011, at

[Rails] Problems installing exception_notification plugin

2011-02-11 Thread Jim Burgess
Hi, I am, trying to install the exception_notification plugin for rails. I am using rails 2.3, and Windows 7 (64 bit) The Rails 3 version is here: https://github.com/rails/exception_notification/ I can install it using git-bash thus: ruby script/install plugin

[Rails] Form check boxes and Forms

2011-02-11 Thread Ollie
Bit of a newbie question but I've got a form and I want bits of the form to appear when a checkbox is clicked. So for example I have a query such as do you want to have a link attached to this post which is a tick box, then I have another field which contains the text box for the link to go in.

[Rails] accept_nested_attributes, reject_if doesn't work.

2011-02-11 Thread Mauro
class Post ActiveRecord::Base validates :name, :presence = true validates :title, :presence = true, :length = { :minimum = 5 } has_many :comments, :dependent = :destroy has_many :tags accepts_nested_attributes_for :tags, :allow_destroy = :true, :reject_if = proc {

[Rails] Re: Get request by session id?

2011-02-11 Thread Frederick Cheung
On Feb 11, 11:12 am, Hans Hartmann li...@ruby-forum.com wrote: I'm not sure what you're after - requests aren't persisted anywhere (unless you're doing something special to do that) I want to find a possibility to get the PATH_INFO of each session user. My first opinion to do that was to

Re: [Rails] accept_nested_attributes, reject_if doesn't work.

2011-02-11 Thread Jim Ruther Nill
Looking at http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.htmlI think accepts_nested_attributes expects an #{association}_attributes key/value pair to be passed as an attribute to the

[Rails] default values and text_field

2011-02-11 Thread Tony Primerano
I have a model and I set defaults for some values by overriding the read accessor. For example def heading read_attribute(:heading).nil? ? 'Please select from:' : read_attribute(:heading) end The problem I have found is that text_field ignores this. %= f.text_field :heading % is empty

[Rails] Rails Bad Practice Survey

2011-02-11 Thread Robert O'regan
Hi, As part of a project I've compiled a VERY short survey on common bad practices encountered when developing Rails applications. The survey comtains a number of bad practices (smells) detected in a sample application. I'm looking for as many Rails developers as possible to scan through the

[Rails] Re: default values and text_field

2011-02-11 Thread Frederick Cheung
On Feb 11, 1:37 pm, Tony Primerano tony.primer...@gmail.com wrote: I have a model and I set defaults for some values by overriding the read accessor.  For example def heading     read_attribute(:heading).nil? ? 'Please select from:' : read_attribute(:heading) end Have you double checked

[Rails] SQL Queries in Rails Console a href=sdf/aobject/object

2011-02-11 Thread hillkj
ActiveRecord::Base.logger = Logger.new(STDOUT) -- View this message in context: http://old.nabble.com/SQL-Queries-in-Rails-Console-%3Ca-href%3D%22sdf%22%3E%3C-a%3E%3Cobject%3E%3C-object%3E-tp30901356p30901356.html Sent from the RubyOnRails Users mailing list archive at Nabble.com. -- You

[Rails] Re: default values and text_field

2011-02-11 Thread Tony Primerano
On Feb 11, 8:45 am, Frederick Cheung frederick.che...@gmail.com wrote: On Feb 11, 1:37 pm, Tony Primerano tony.primer...@gmail.com wrote: I have a model and I set defaults for some values by overriding the read accessor.  For example def heading     read_attribute(:heading).nil? ?

Re: [Rails] Gem to work with image attachement

2011-02-11 Thread Andre Fonseca
Thanks. I gonna take a look on Ruby toolbox -- Abraços Sinceros e Agradecidos Andre Fonseca http://www.andrefonseca.net -- 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

Re: [Rails] Rails Bad Practice Survey

2011-02-11 Thread Jim Ruther Nill
Send them this way :D On Fri, Feb 11, 2011 at 9:44 PM, Robert O'regan li...@ruby-forum.comwrote: Hi, As part of a project I've compiled a VERY short survey on common bad practices encountered when developing Rails applications. The survey comtains a number of bad practices (smells) detected

Re: [Rails] Re: default values and text_field

2011-02-11 Thread Jim Ruther Nill
are you sure that heading is nil? could you double check if it's not an empty string? On Fri, Feb 11, 2011 at 9:50 PM, Tony Primerano tony.primer...@gmail.comwrote: On Feb 11, 8:45 am, Frederick Cheung frederick.che...@gmail.com wrote: On Feb 11, 1:37 pm, Tony Primerano

[Rails] Re: rvm install 1.8.7 prompts There has been an error while running make. Halting the installation.

2011-02-11 Thread John Merlino
Frederick Cheung wrote in post #980922: Error running 'make ', please read /Users/jmerlino/.rvm/log/ruby-1.8.7-p330/make.log So, what was in it? Fred Towards bottom it says this: readline.c: In function ‘username_completion_proc_call’: readline.c:730: error: ‘username_completion_function’

[Rails] Delete routes to Edit?

2011-02-11 Thread pete
Hi- I encountered a problem I have never seen before. For some reason, requests for Destroy are routing to Edit. Here's the route: DELETE /instructions/:id(.:format) {:action=destroy, :controller=instructions} Here's the call to render it: %= link_to 'Delete', instruction, :confirm = 'Are

[Rails] Re: default values and text_field

2011-02-11 Thread Tony Primerano
The string is nil. I even created a new rails project to test this out. (Rails 3 / 1.9.2) rails generate scaffold test value1:string value2:integer app/models/test.rb class Test ActiveRecord::Base def value1 read_attribute(:value1).nil? ? 'hello' : read_attribute(:value1) end def

Re: [Rails] Delete routes to Edit?

2011-02-11 Thread Jim Ruther Nill
are you using rails 3? this problem usually occur if you remove the javascripts to be used to handle the :confirm argument and the csrf meta tag. On Fri, Feb 11, 2011 at 11:46 PM, pete peterbattag...@gmail.com wrote: Hi- I encountered a problem I have never seen before. For some reason,

[Rails] Re: Delete routes to Edit?

2011-02-11 Thread pete
Yes, and I did remove the CSRF meta tag. Thanks, I'll look into it! On Feb 11, 8:58 am, Jim Ruther Nill jvn...@gmail.com wrote: are you using rails 3? this problem usually occur if you remove the javascripts to be used to handle the :confirm argument and the csrf meta tag. On Fri,

[Rails] Re: Delete routes to Edit?

2011-02-11 Thread pete
Hmm, I uncommented the CSRF meta tag, ensured I was including the default javascripts and restarted, same issue. I have added my own js files, is it likely a conflict with those? On Feb 11, 9:01 am, pete peterbattag...@gmail.com wrote: Yes, and I did remove the CSRF meta tag. Thanks, I'll

Re: [Rails] Re: Delete routes to Edit?

2011-02-11 Thread Jim Ruther Nill
hmm, just to be sure, try removing the confirm argument and check if it goes to the destroy action. On Sat, Feb 12, 2011 at 12:05 AM, pete peterbattag...@gmail.com wrote: Hmm, I uncommented the CSRF meta tag, ensured I was including the default javascripts and restarted, same issue. I have

Re: [Rails] Re: default values and text_field

2011-02-11 Thread Jim Ruther Nill
Sorry, I can't help you out as I'm not on my dev box. One thing off the top of my mind (so you wont have to worry about that) is to use a placeholder attribute instead of doing that check. Good luck! http://davidwalsh.name/html5-placeholder On Fri, Feb 11, 2011 at 11:57 PM, Tony Primerano

[Rails] Re: Delete routes to Edit?

2011-02-11 Thread pete
Nope, I removed the confirm and it still goes to Edit. On Feb 11, 9:10 am, Jim Ruther Nill jvn...@gmail.com wrote: hmm, just to be sure, try removing the confirm argument and check if it goes to the destroy action. On Sat, Feb 12, 2011 at 12:05 AM, pete peterbattag...@gmail.com wrote:

Re: [Rails] Own theme

2011-02-11 Thread Bhasker Harihara
Solved, I missed out a ; that;s it. Anyway thaks. On Fri, Feb 11, 2011 at 8:23 AM, Hassan Schroeder hassan.schroe...@gmail.com wrote: On Thu, Feb 10, 2011 at 6:37 PM, Bhasker Harihara harihara.bhas...@gmail.com wrote: So inside my custom.css I use background-color: (url:--) This works

Re: [Rails] Re: Delete routes to Edit?

2011-02-11 Thread Jim Ruther Nill
btw, see if you can figure something out on this thread. http://railsforum.com/viewtopic.php?id=41563 http://railsforum.com/viewtopic.php?id=41563good luck! On Sat, Feb 12, 2011 at 12:21 AM, Jim Ruther Nill jvn...@gmail.com wrote: hmm. that's weird. i can't think of any cause atm. what js

[Rails] Counting items in associate with a limit

2011-02-11 Thread Rob Nichols
Rails 3 --- I have a relationship where Category has_and_belongs_to_many Article. I want to grab a small subsection of articles related to a particular category. When I try to iterate over these, Rails tries to count the records and gets the wrong number. The issue is that there is bug in

Re: [Rails] Decimal Columns Allow Defaults?

2011-02-11 Thread Philip Hallstrom
On Feb 10, 2011, at 1:54 PM, Karl Smith wrote: Is :default allowed as an option for decimal columns? A migration: class CreateMoney ActiveRecord::Migration def self.up create_table :money do |t| t.decimal :amount, :defaut = 0.0, :precision = 8, :scale = 2 end end def

[Rails] Re: Delete routes to Edit?

2011-02-11 Thread pete
It's a JS problem. I am using a number of mapping libraries but I think the heart of the problem is JQuery, looks like it conflicts with Prototype?? Thanks for your feedback! On Feb 11, 9:26 am, Jim Ruther Nill jvn...@gmail.com wrote: btw, see if you can figure something out on this

Re: [Rails] Re: Delete routes to Edit?

2011-02-11 Thread Rob Biedenharn
On Feb 11, 2011, at 11:56 AM, pete wrote: It's a JS problem. I am using a number of mapping libraries but I think the heart of the problem is JQuery, looks like it conflicts with Prototype?? Thanks for your feedback! Have you replaced the rails.js with the one for jQuery?

[Rails] Rails 3 working with and SSL

2011-02-11 Thread Mark C.
I have a Rails 3 app using Ruby 1.9.2 configured to work on the Linux server. The uses SSL to access all there resources. Now, I am dealing with the SSL so that I can display the application on the client side. The user LDAP credentials are being passed to the Linux server through instructions in

[Rails] Re: Rails 3 working with webrick and SSL

2011-02-11 Thread Fernando Perez
If I recall correctly, webrick doesn't support SSL. Mongrel neither. You'll have to use Apache or Nginx for that. Yes, SSL dev for Rails is a bit painful. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails:

[Rails] Re: understanding rails project

2011-02-11 Thread Megas Megas
Michael Pavling wrote in post #980954: (Partial, I assume). Yes, a little searching... but the context-sensitive control-clicking in my IDE lets me follow through very quickly, and I generally try to name stuff to be simple to find again (the self-documenting approach) Yes, you're right,

[Rails] Real-time web traffic alert notifications (email or SMS) on the cheap?

2011-02-11 Thread Brian Morearty
I'm a big fan of New Relic. One of the services they provide is alerts when your traffic goes up unexpectedly above a predetermined level. Does anyone have a favorite, inexpensive traffic alert tool that can be used on a small site--a site that's not yet big enough for monthly payments of $150

[Rails] Complex Active_record associations

2011-02-11 Thread tspore
So I have 3 models - Users, Roles, Records. For each record X user, can have 1 of 3 roles, and those roles will give different permissions on each record. So for example, user 1 - has a role of follower on record 5, also user 1 - is a manager(role) of record 4, etc. So what I am trying to do, is

[Rails] Re: rvm install 1.8.7 prompts There has been an error while running make. Halting the installation.

2011-02-11 Thread Frederick Cheung
On Feb 11, 3:36 pm, John Merlino li...@ruby-forum.com wrote: Frederick Cheung wrote in post #980922: Error running 'make ', please read /Users/jmerlino/.rvm/log/ruby-1.8.7-p330/make.log So, what was in it? Fred Towards bottom it says this: readline.c: In function

[Rails] Regex for string first chars - Model validation

2011-02-11 Thread Rodrigo Alves Vieira
Hello everyone, in my Rails app I need to validate a string that on creation can not have its first chars empty or composed by any special chars. For example: file and %file aren't valid. Do you know what Regex I should use? Thanks! -- You received this message because you are subscribed

Re: [Rails] Regex for string first chars - Model validation

2011-02-11 Thread kedar mhaswade
On Fri, Feb 11, 2011 at 11:30 AM, Rodrigo Alves Vieira rodrig...@gmail.comwrote: Hello everyone, in my Rails app I need to validate a string that on creation can not have its first chars empty or composed by any special chars. For example: file and %file aren't valid. Do you know what Regex

Re: [Rails] Regex for string first chars - Model validation

2011-02-11 Thread Philip Hallstrom
On Fri, Feb 11, 2011 at 11:30 AM, Rodrigo Alves Vieira rodrig...@gmail.com wrote: Hello everyone, in my Rails app I need to validate a string that on creation can not have its first chars empty or composed by any special chars. For example: file and %file aren't valid. Do you know what

Re: [Rails] Regex for string first chars - Model validation

2011-02-11 Thread Rodrigo Alves Vieira
Hello, thanks for the reply, but after applying this regex I go to rails console and run a = File.new a.file_name = example.txt It still works, when it shouldn't... any more help? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To

Re: [Rails] Regex for string first chars - Model validation

2011-02-11 Thread Rodrigo Alves Vieira
Undescore is allowed. -- 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-talk+unsubscr...@googlegroups.com. For

Re: [Rails] Regex for string first chars - Model validation

2011-02-11 Thread Rodrigo Alves Vieira
Underscore is allowed. -- 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-talk+unsubscr...@googlegroups.com.

[Rails] Re: can you portably store infinity via AR?

2011-02-11 Thread Fearless Fool
Where it stands: Infinity can be represented in IEEE floating point numbers. Infinity can be represented in Ruby, as evidenced by (1.0/0.0).infinite? = 1 Infinity can be represented in sqlite (and probably other databases): sqlite select * from test_recs; 1|Inf| Yet it appears that

[Rails] rails 3 initialize module, running cucumber

2011-02-11 Thread Me
I have this in my environment file, I get The error occurred while evaluating nil.[] (NoMethodError) on the S3Config.key= line when running cucumber. Why is it not loading up the module when running cucumber? module S3Config mattr_accessor :key mattr_accessor :sec end class

[Rails] An hash of arrays, how to use?

2011-02-11 Thread Norbert Melzer
Hello everybody! I have a problem with an Hash of Arrays. ruby-1.9.2-p136 :001 x = Hash.new Array.new = {} ruby-1.9.2-p136 :002 x[test] test = [test] ruby-1.9.2-p136 :003 x = {} ruby-1.9.2-p136 :004 x.keys = [] ruby-1.9.2-p136 :005 x[test] = [test] ruby-1.9.2-p136 :006 Why is keys

[Rails] Re: Real-time web traffic alert notifications (email or SMS) on the cheap?

2011-02-11 Thread tspore
for a cheap simple monitor tool for a site that is up or down - http://monitor.rootinternet.co.uk/en/index.php On Feb 11, 10:53 am, Brian Morearty li...@ruby-forum.com wrote: I'm a big fan of New Relic. One of the services they provide is alerts when your traffic goes up unexpectedly above a

[Rails] Re: An hash of arrays, how to use?

2011-02-11 Thread Frederick Cheung
On Feb 11, 9:09 pm, Norbert Melzer timmel...@googlemail.com wrote: Hello everybody! I have a problem with an Hash of Arrays. ruby-1.9.2-p136 :001 x = Hash.new Array.new  = {} ruby-1.9.2-p136 :002 x[test] test  = [test] ruby-1.9.2-p136 :003 x  = {} ruby-1.9.2-p136 :004 x.keys  =

[Rails] Re: Regex for string first chars - Model validation

2011-02-11 Thread Kai Middleton
Philip's idea seems pretty good: ^\w+ That says: look for any string that starts with one or more word characters (letters, numbers, underscores). Try it out in rubular: http://rubular.com/ It let's you quickly experiment with lots of regular expressions and has a quick-ref right there on the

[Rails] is equal operator to check current user is owner

2011-02-11 Thread msaspence
I'm want to restrict access to an object show action to the owner in my action I have this def show @thing = Thing.find(params[:id]) if current_user @thing.owner == current_user respond_to do |format| format.json { render :json = @thing } end else render

Re: [Rails] Re: An hash of arrays, how to use?

2011-02-11 Thread Norbert Melzer
2011/2/11 Frederick Cheung frederick.che...@gmail.com: On Feb 11, 9:09 pm, Norbert Melzer timmel...@googlemail.com wrote: Why is keys empty? because you've never actually done x[test]= ... (all you're doing is modifying the hash's default value) OK, now I tried the following b =

Re: [Rails] Re: An hash of arrays, how to use?

2011-02-11 Thread botp
On Sat, Feb 12, 2011 at 9:25 AM, Norbert Melzer timmel...@googlemail.com wrote: OK, now I tried the following      b = Hash.new(Array.new)      h = XmlSimple.xml_in self.raw      h[data][0][bank][0][item].each do |item| delete line        if b.key? item[cat] add line        if !b.key?

[Rails] DRY in rspec tests

2011-02-11 Thread S. Widmann
Hi, I've got a lot of rspec controller tests. At the beginning of each controller, I have: def authenticate ... end def logout ... end Authenticates creates me a @current_user, logout destroys the @current_user. As I said, this code is at the beginning of each controller, not very DRY :-)

Re: [Rails] DRY in rspec tests

2011-02-11 Thread Philip Hallstrom
I've got a lot of rspec controller tests. At the beginning of each controller, I have: def authenticate ... end def logout ... end Authenticates creates me a @current_user, logout destroys the @current_user. As I said, this code is at the beginning of each controller, not very