Re: [Rails] how instance_eval on Object class creating class methods and not instance methods?

2011-05-16 Thread Frederick Cheung
On 17 May 2011, at 02:20, John Merlino wrote: > THe guy says: > "The first instance_eval is used to add class method has_attribute into > Object so that we can call it in all the inherited class." > > I'm a little thrown off by this statement. First, Object itself is an > instance of class Clas

Re: [Rails] check box

2011-05-16 Thread Narendra sisodiya
a small correction in your form <%form_for(:person) do |f|%> On Tue, May 17, 2011 at 11:12 AM, bala TS wrote: > html.erb > > <%form_for(:person do |f|)%> > <%= check_box(:person,:permanent_employee,:options=>{},:on_value => > "1",:off_value => "0")%> > <%end> > > controller > edit_method >

[Rails] Re: check box tag

2011-05-16 Thread bala TS
html.erb <%form_for(:person do |f|)%> <%= check_box(:person,:permanent_employee,:options=>{},:on_value => "1",:off_value => "0")%> <%end> controller edit_method @person=Person.find_by_id(params[:id]) @person.update_attributes(params[::person]) @person.permanent = params[:person][:permanent_e

[Rails] check box

2011-05-16 Thread bala TS
html.erb <%form_for(:person do |f|)%> <%= check_box(:person,:permanent_employee,:options=>{},:on_value => "1",:off_value => "0")%> <%end> controller edit_method @person=Person.find_by_id(params[:id]) @person.update_attributes(params[::person]) @person.permanent = params[:person][:permanent_e

[Rails] uninitialized constant Delayed::Job (NameError)

2011-05-16 Thread News Aanad
hi I am implementing delayed_job in my rails app. *my code is:* file name is: my_worker.rb require "delayed_job" require "rubygems" class MyClass def perform while true do puts "I am in My class!!!" sleep 2 end end end Delayed::Job.enqueue( MyClass.new ) #m.perform

[Rails] Nested Resource w/ Collection

2011-05-16 Thread Chad Eubanks
Hi guys, In my routes file I have the following nested resource: resources :users do collection do get 'posts' end end However, when I visit this URL: http://localhost:3000/users/posts, I get this error: "The action 'posts' could not be found for UsersController" In

[Rails] Re: Problem with GET args and UTF-8 encoding (output of Rack::Utils.unescape() ?)

2011-05-16 Thread ddellacosta
Thanks for pointing out the obvious Frederick (seriously, thank you). The problem was completely on the JavaScript/browser side; the function which prepared the query string was using escape() rather than encodeURIComponent(). I replaced all the calls to escape and things started to magically work

[Rails] Re: Rails app returning 302 redirects, is that bad?

2011-05-16 Thread Robert Walker
jiblethead wrote in post #999139: > Maybe a bit off-topic here, but I have a site "mysite.com" and an > action that will take "mysite.com/keyword" and find the most > appropriate page for that keyword. I did it as a way to handle old > bookmarks that I can't control, but still provide content that

[Rails] how instance_eval on Object class creating class methods and not instance methods?

2011-05-16 Thread John Merlino
Hey all, I am a little confused about a tutorial I read. Here's an example below taken from the tutorial: Object.instance_eval do def has_attribute( *attrs ) attrs.each do | attr | self.class_eval %Q{ def #{attr}=(val) instance_variable_set

[Rails] Re: unexpected results when extending methods to class Class and class Object

2011-05-16 Thread John Merlino
> but instances of Object aren't i.e. Object.kind_of? Class is the wrong > test - Object.new.kind_of?(Class) (or in your specific example, > Peach.new.kind_of?(Class)) is the relevant one. > > Fred Thanks for response -- Posted via http://www.ruby-forum.com/. -- You received this message beca

[Rails] HTML snapshots for crawlable ajax

2011-05-16 Thread Mustafa C.
Hi, There doesn't seem to be any reference for taking HTML snapshots from within a Rails server. I wonder how one could implement Google's crawlable AJAX spec (http://code.google.com/web/ajaxcrawling/docs/learn-more.html)on a Rails application? To summarize: I have a Rails application with a Java

[Rails] Re: Devise help!!

2011-05-16 Thread jiblethead
> I just upgraded from restful_authentication to devise, and before I > found out there was a wiki on how to do this properly, I removed all > traces of restful_authentication from my app, then installed Devise like > I normally would. > > The issue I'm getting is I create an account, and when I co

[Rails] Rails app returning 302 redirects, is that bad?

2011-05-16 Thread jiblethead
Maybe a bit off-topic here, but I have a site "mysite.com" and an action that will take "mysite.com/keyword" and find the most appropriate page for that keyword. I did it as a way to handle old bookmarks that I can't control, but still provide content that's useful (instead of 404 error, for examp

Re: [Rails] Malay ?

2011-05-16 Thread Tom Meinlschmidt
check, what does chrome sent in headers: eg Accept-Language -> en-us,de;q=0.7,en;q=0.3 tom On May 16, 2011, at 23:10 , Alex Katebi wrote: > Why does my browser think that my page has Malay in it and wants to > translate it? > Rails 3.1 beta using Chrome > > -- > You received this message beca

Re: [Rails] You cannot have more than one Rails::Application (RuntimeError)

2011-05-16 Thread Tom Meinlschmidt
hi, don't you have any of the rails apps running? try restart or shutdown your monrel/webrick/phusion etc servers... tom On May 16, 2011, at 21:41 , Craig Cherlet wrote: > I installed RVM and am getting a kinds of errors. I have managed to get > most things back to normal but I get this error

[Rails] Malay ?

2011-05-16 Thread Alex Katebi
Why does my browser think that my page has Malay in it and wants to translate it? Rails 3.1 beta using Chrome -- 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 unsub

[Rails] Re: NoMethodError: undefined method `acts_as_state_machine'

2011-05-16 Thread Kendall Gifford
On Monday, May 16, 2011 9:05:10 AM UTC-6, dhayalan wrote: > > Hello All, > > Am upgrading my rails app from rails 2.1.0 to 2.3.11, while login am facing > bug > > for login am using code "self.current_user = > User.authenticate(params[:login], params[:password])" > > Bug: > > "NoMethodError: und

[Rails] Rails 3 and octet-stream content-type

2011-05-16 Thread Dimas Cyriaco
Hi, i am migration an rails 2.3 application to rails 3, and i'm having some problems with post requests with 'octet-stream' content-type. The problem is that rails is not passing the octet-stream params to the controllers. We have some mobile apps (J2ME) sending us post requests with octet-str

Re: [Rails] Re: interview questions on REST

2011-05-16 Thread Bryan Crossland
Sent from my iPhone On May 16, 2011, at 2:31 PM, "wbsurf...@yahoo.com" wrote: > > > So I had done some things in the past with map.resources in the > routes, but I never really fully understood all of it, especially when > there was more than one level with children such as: > > map.resources

Re: [Rails] Help with 'new' form code - 'render' vs 'redirect_to'

2011-05-16 Thread Rodrigo Ruiz
Thank you. On Mon, May 16, 2011 at 2:22 PM, David Kahn wrote: > > > On Mon, May 16, 2011 at 1:04 PM, Rodrigo Ruiz wrote: > >> Now I think I got it, thank you. >> >> I need @user = User.new for the line 'form_for(@user)' in the view >> 'new.html.erb' right? >> >> Correct > > >> And what is the poi

[Rails] You cannot have more than one Rails::Application (RuntimeError)

2011-05-16 Thread Craig Cherlet
I installed RVM and am getting a kinds of errors. I have managed to get most things back to normal but I get this error now in one of my apps. /.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/application.rb:63:in `inherited': You cannot have more than one Rails::Application (RuntimeError)

[Rails] Re: interview questions on REST

2011-05-16 Thread wbsurf...@yahoo.com
So I had done some things in the past with map.resources in the routes, but I never really fully understood all of it, especially when there was more than one level with children such as: map.resources :bookmarks, :has_many => [:comments] I had kind of rushed through some examples and I sho

[Rails] Re: interview questions on REST

2011-05-16 Thread wbsurf...@yahoo.com
Thanks, I have been through that wikipedia dry and theoretical stuff a bit before. Some of it is useful, but I can't always seem to draw out what are the main points that I should care the most about and what is assumed such as client/server is obviously an assumption, but if I don't give a full

[Rails] Re: setup Mysql / rails 3.0.3 Snow leopard 32bit

2011-05-16 Thread Rebecca Dias
Mike I am also a newbie. Where might I find this bundle file? -- 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 unsubscri

Re: [Rails] Help with 'new' form code - 'render' vs 'redirect_to'

2011-05-16 Thread David Kahn
On Mon, May 16, 2011 at 1:04 PM, Rodrigo Ruiz wrote: > Now I think I got it, thank you. > > I need @user = User.new for the line 'form_for(@user)' in the view > 'new.html.erb' right? > > Correct > And what is the point of making '@user' instead of 'user' (local variable) > if it will be lost any

Re: [Rails] Help with 'new' form code - 'render' vs 'redirect_to'

2011-05-16 Thread Rodrigo Ruiz
Now I think I got it, thank you. I need @user = User.new for the line 'form_for(@user)' in the view 'new.html.erb' right? And what is the point of making '@user' instead of 'user' (local variable) if it will be lost anyway for other requests? On Mon, May 16, 2011 at 1:51 PM, David Kahn wrote: >

Re: [Rails] Problem with GET args and UTF-8 encoding (output of Rack::Utils.unescape() ?)

2011-05-16 Thread Frederick Cheung
On 16 May 2011, at 14:47, ddellacosta wrote: > Hi folks, > > Here's my basic issue, hopefully this is clear. I'm trying to submit > some UTF-8 values in my query string, but they are coming out mangled > on the other end. It *seems* like the problem is that what > Rack::Utils.unescape() push

Re: [Rails] Help with 'new' form code - 'render' vs 'redirect_to'

2011-05-16 Thread David Kahn
On Mon, May 16, 2011 at 12:46 PM, Rodrigo Ruiz wrote: > if it has no knowledge of @user in the 'new' action, why do I need to do > @user = User.new? What is the point, if it will be lost for other actions? > > @user is used in @user = User.new so that you have your new user object available for th

[Rails] Re: Re: Devise help!!

2011-05-16 Thread Jeremy Woertink
Paul wrote in post #999045: > Not knowing, but as a guess I'd look at the way passwords are being > encrypted. When you log in the first time, it probably doesn't get > your password out of the database. So, do the encryption and > decryption match? Are you correctly using the salt? > > Just a shot

Re: [Rails] Help with 'new' form code - 'render' vs 'redirect_to'

2011-05-16 Thread Rodrigo Ruiz
if it has no knowledge of @user in the 'new' action, why do I need to do @user = User.new? What is the point, if it will be lost for other actions? I thought that all that i wrote with '@' in ruby was an instance variable, meaning it is accessible to the whole instance, meaning any of its methods.

[Rails] NoMethodError: undefined method `acts_as_state_machine'

2011-05-16 Thread Dhayalan Karunakaran
Hello All, Am upgrading my rails app from rails 2.1.0 to 2.3.11, while login am facing bug for login am using code "self.current_user = User.authenticate(params[:login], params[:password])" Bug: "NoMethodError: undefined method `acts_as_state_machine' for #" Can anyone help me out. Thanks in

Re: [Rails] Re: how best to test modules for 'mixing-in' with AR classes?

2011-05-16 Thread Frederick Cheung
On 16 May 2011, at 16:01, Lille wrote: > Thanks! > > So, maybe I automate the creation of the in-memory database with a > rake task for the test? If not, what do you think? > > I think an issue here is that my modules assuming their parents are AR > classes. Is that really modular? Depends on

[Rails] Re: Problem with GET args and UTF-8 encoding (output of Rack::Utils.unescape() ?)

2011-05-16 Thread ddellacosta
Okay, I'm still not there but I've realized I've been confusing a few things. This stackoverflow answer helped a lot: http://stackoverflow.com/questions/5083032/how-to-utf-8-encode-a-character-string/5083858#5083858 I was conflating Unicode with UTF-8. But, I think that's also essentially what

Re: [Rails] Re: Devise help!!

2011-05-16 Thread Paul
Not knowing, but as a guess I'd look at the way passwords are being encrypted. When you log in the first time, it probably doesn't get your password out of the database. So, do the encryption and decryption match? Are you correctly using the salt? Just a shot in the dark... On Mon, May 16, 2011 a

Re: [Rails] Anti virus scan in rails

2011-05-16 Thread Philip Hallstrom
> I have file uploading functionality .present i want to before file > save i want to run virus scan , how is it possible .Let me know any one Might look into clamav... -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this g

Re: [Rails] PDF generator - Prawn and Prawnto.

2011-05-16 Thread Paul
+1 on wkhtmltopdf with no gem. That has been the easiest for me. On Mon, May 16, 2011 at 10:25 AM, David Kahn wrote: > > > On Mon, May 16, 2011 at 4:44 AM, jack kw wrote: >> >> I'm quite confuse with prawn and prawnto. >> is it must install prawn with prawnto to generate pdf ? >> what prawnto

Re: [Rails] Anti virus scan in rails

2011-05-16 Thread Jim Ruther Nill
On Mon, May 16, 2011 at 11:39 PM, Prasad B. wrote: > Hi, > I have file uploading functionality .present i want to before file > save i want to run virus scan , how is it possible .Let me know any one > . > > just googled something about this and found this post. http://stackoverflow.com/questi

[Rails] Anti virus scan in rails

2011-05-16 Thread Prasad B.
Hi, I have file uploading functionality .present i want to before file save i want to run virus scan , how is it possible .Let me know any one . Thanks. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: T

[Rails] Re: how best to test modules for 'mixing-in' with AR classes?

2011-05-16 Thread Lille
Thanks! So, maybe I automate the creation of the in-memory database with a rake task for the test? If not, what do you think? I think an issue here is that my modules assuming their parents are AR classes. Is that really modular? Lille On May 16, 10:47 am, Frederick Cheung wrote: > On May 16,

Re: [Rails] Re: how to connect a form field to a table from another database?

2011-05-16 Thread Bryan Crossland
Sent from my iPhone On May 16, 2011, at 3:27 AM, Mauro wrote: > On 14 May 2011 14:09, Bryan Crossland wrote: >> Sent from my iPhone >> On May 13, 2011, at 3:31 PM, Mauro wrote: >> >> On 12 May 2011 17:13, Mauro wrote: >> >> I have a form with some fields. >> >> In one of these ones the use

[Rails] Re: how best to test modules for 'mixing-in' with AR classes?

2011-05-16 Thread Frederick Cheung
On May 16, 3:37 pm, Lille wrote: > Hi, > > I'm converting some AR classes into modules and moving their > attributes to whatever AR classes formerly held the association. > > I'm finding it hard to test these modules. > > I think I want to use a tableless AR model in my module tests. I just > de

[Rails] Problem with GET args and UTF-8 encoding (output of Rack::Utils.unescape() ?)

2011-05-16 Thread ddellacosta
Hi folks, Here's my basic issue, hopefully this is clear. I'm trying to submit some UTF-8 values in my query string, but they are coming out mangled on the other end. It *seems* like the problem is that what Rack::Utils.unescape() pushes out gets converted to UTF-8 somewhere in the chain (using

[Rails] Help, Exchanging JS Token for Rest Token using Ruby Oauth

2011-05-16 Thread Vibhor
Has anyone tried exchanging the JSAPI token for Oauth token using Oauth Gem? I'm getting invalid signature error. Am I missing something? The code snippets are available at following discussion link: http://developer.linkedin.com/thread/3076?tstart=0#3076 -- You received this message because you

[Rails] how best to test modules for 'mixing-in' with AR classes?

2011-05-16 Thread Lille
Hi, I'm converting some AR classes into modules and moving their attributes to whatever AR classes formerly held the association. I'm finding it hard to test these modules. I think I want to use a tableless AR model in my module tests. I just define one of these -- with the attributes the module

Re: [Rails] PDF generator - Prawn and Prawnto.

2011-05-16 Thread David Kahn
On Mon, May 16, 2011 at 4:44 AM, jack kw wrote: > I'm quite confuse with prawn and prawnto. > is it must install prawn with prawnto to generate pdf ? > what prawnto does ? > Prawnto adds rails support for prawn such as a template handler (.prawn). I guess you could use prawn directly if you did

[Rails] Re: "rails new" command always takes me to help

2011-05-16 Thread ianha
Thanks everyone, running 'gem cleanup' seems to have done the trick'! On May 16, 4:27 am, QAS WM wrote: > I came across the same issue couple of days ago and it seemed to be a > problem with some of the installed gems, I had done gem cleanup and > removed some dependent gems. A fresh install on a

Re: [Rails] "rails new" command always takes me to help

2011-05-16 Thread Colin Law
On 15 May 2011 22:04, ianha wrote: > Couldn't find a solution anywhere so I'm posting here. > > I'm running rvm and Ruby 1.9.2-p180 [x86_64].  I installed rails 3.0.7 > via 'gem install rails' and was running 'rails new' at command line > without issue (Mac OS X, 10.6.6) for some time now to creat

Re: [Rails] ActiveRecord - default ID vs custom identifier

2011-05-16 Thread Colin Law
On 14 May 2011 13:04, comopasta Gr wrote: > Hi, > > So far I've let Rails and ActiveRecord rule the game. But I think > there's some things I should change. > > I have a record (called Tag) that is searched by using the default auto > incrementable Id that AR provides. On the Tag record I also kee

Re: [Rails] How can I avoid this warning?

2011-05-16 Thread Peter Hickman
It is saying that mongo does not appear to be running or at least it is not running on the machine that your script is running on or is not running on port 27017. Are you running mongo on your machine? It is just the same as running MySQL or PostgreSQL in that it is an independent service. Unlike

[Rails] How can I avoid this warning?

2011-05-16 Thread Mohammed Niyas
This warning repeatedly will occurs. /usr/local/lib/ruby/gems/1.9.1/gems/mongo-1.2.4/lib/mongo/connection.rb:469:in `connect': Failed to connect to a master node at localhost:27017 (Mongo::ConnectionFailure) Someone explain for this warning.Example:require rubygems and require mongodb. But ag

Re: [Rails] interview questions on REST

2011-05-16 Thread Bryan Crossland
On Mon, May 16, 2011 at 7:14 AM, Bryan Crossland wrote: > On Mon, May 16, 2011 at 4:41 AM, wbsurf...@yahoo.com > wrote: > >> >> >> I sometimes get asked about what is REST in an interview. I feel like >> I have a sense of what it is, yet the answer seems somewhat >> theoretical. When I built a w

Re: [Rails] interview questions on REST

2011-05-16 Thread Bryan Crossland
On Mon, May 16, 2011 at 4:41 AM, wbsurf...@yahoo.com wrote: > > > I sometimes get asked about what is REST in an interview. I feel like > I have a sense of what it is, yet the answer seems somewhat > theoretical. When I built a website that supported sub domains for > rock bands, I felt I got som

Re: [Rails] Re: Cannot get multipart => true , running well in my form when using remote => true

2011-05-16 Thread Imran Latif
So, you want to upload Files (Images, PDFs) via Ajax. Well thats not impossible at all. We can upload files using Ajax. I have done it and it is working quite fine for me. Please! take a look at this tutorial. I' am sure it will helps you a lot. http://khamsouk.souvanlasy.com/articles/ajax-file-u

[Rails] Handle gem versions compatibility

2011-05-16 Thread Gregory Ma
Hi, I am building a gem and I am not sure how to handle dependencies versions. The gem I need is ActiveSupport and I want my gem to be compatible with version 2.3.x and 3.x.x In my code I need the classify method from the inflector module. But they don't work the same way in version 2.3.x ans in

[Rails] Re: Cannot get multipart => true , running well in my form when using remote => true

2011-05-16 Thread Erwin
[SOLVED well not solved but IMPOSSIBLE]seems cannot be done via Ajax ... need to review my design On 16 mai, 12:06, Erwin wrote: > I have a simple form , with a file field >         = form_for (Clip.new), :html => {:multipart => true} ,  :remote => > true ,  do |f| >        = f.hidden_fi

[Rails] Cannot get multipart => true , running well in my form when using remote => true

2011-05-16 Thread Erwin
I have a simple form , with a file field = form_for (Clip.new), :html => {:multipart => true} , :remote => true , do |f| = f.hidden_field :user_id, {:value => current_user.id} = f.text_field :name = f.text_area :description = f.file_field :image = f.su

[Rails] PDF generator - Prawn and Prawnto.

2011-05-16 Thread jack kw
I'm quite confuse with prawn and prawnto. is it must install prawn with prawnto to generate pdf ? what prawnto does ? -- 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

[Rails] interview questions on REST

2011-05-16 Thread wbsurf...@yahoo.com
I sometimes get asked about what is REST in an interview. I feel like I have a sense of what it is, yet the answer seems somewhat theoretical. When I built a website that supported sub domains for rock bands, I felt I got some sense of what it was, yet I was not sure exactly how to define it in

Re: [Rails] Re: Exception - not sure how to fix

2011-05-16 Thread Chris Mear
On 15 May 2011 23:51, Carl Jenkins wrote: > Frederick Cheung wrote in post #998691: >> On May 14, 2:03pm, Carl Jenkins wrote: >>> I am running ruby 1.8.7 and rails 3.0.7 on a MacPro. >>> >>> When I run a command - something as simple as 'gem list --local' I get a >>> stack trace in the terminal.

[Rails] Re: select_tag form_for conventions

2011-05-16 Thread johnlucas
ops, that was very easy... thanks! On May 16, 11:33 am, Chris Mear wrote: > On 16 May 2011 09:14, johnlucas wrote: > > > > > > > > > > > I wonder if I am missing some conventions for the select_tag. > > > In fact, while the f.text_field is automatically naming the html text > > field form_name[

Re: [Rails] select_tag form_for conventions

2011-05-16 Thread Chris Mear
On 16 May 2011 09:14, johnlucas wrote: > I wonder if I am missing some conventions for the select_tag. > > In fact, while the f.text_field is automatically naming the html text > field form_name[field_name] just using the :field_name convention, > like: > >         >                <%= f.label :da

[Rails] Re: Integrations tests without cookies

2011-05-16 Thread Michel Pigassou
Nobody here is working on an API and is concerned by this matter? -- 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 rubyo

[Rails] Re: "rails new" command always takes me to help

2011-05-16 Thread QAS WM
I came across the same issue couple of days ago and it seemed to be a problem with some of the installed gems, I had done gem cleanup and removed some dependent gems. A fresh install on all the gems and rails itself helped me. hth. Q ianha wrote in post #998925: > Couldn't find a solution any

Re: [Rails] Re: how to connect a form field to a table from another database?

2011-05-16 Thread Mauro
On 14 May 2011 14:09, Bryan Crossland wrote: > Sent from my iPhone > On May 13, 2011, at 3:31 PM, Mauro wrote: > > On 12 May 2011 17:13, Mauro wrote: > > I have a form with some fields. > > In one of these ones the user can put data of type address, like > > "example street" and so on. > > I wan

[Rails] select_tag form_for conventions

2011-05-16 Thread johnlucas
Hi guys, I wonder if I am missing some conventions for the select_tag. In fact, while the f.text_field is automatically naming the html text field form_name[field_name] just using the :field_name convention, like: <%= f.label :data_point_id %> <%= f.text_