[Rails] Re: Find the largest value of given 3 values

2012-09-18 Thread Manoj M.
Maddy wrote in post #1076411: Hi folks, Good day! *I want to find the largest value of given 3 values.* *Please suggest me,the simple ways of finding the largest value.* if a,b and c are numbers if(ab) { if(ac) {(a is largest)} else {(c is largest)} } else { if(bc) {(b is largest)} else

Re: [Rails] Re: Find the largest value of given 3 values

2012-09-18 Thread rovin varshney
simply put all numbers in array and call max method. a=[2,3,4] a.max On Tue, Sep 18, 2012 at 11:30 AM, Manoj M. li...@ruby-forum.com wrote: Maddy wrote in post #1076411: Hi folks, Good day! *I want to find the largest value of given 3 values.* *Please suggest me,the simple ways

[Rails] Re: Re: Find the largest value of given 3 values

2012-09-18 Thread Manoj M.
rovin varshney wrote in post #1076418: simply put all numbers in array and call max method. a=[2,3,4] a.max yes Rovin ruby way :) -- 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

Re: [Rails] id NOT IN (?)

2012-09-18 Thread daynthan kabilan
Dear Walter sorry for the delay reply. am using rails 2.3.11 am using your condition by @users = User.find(:all, :conditions=[id NOT IN (?), @issues.map(:id)]) that time also i got both output and i got the correct output for this condition. :conditions=[id not in (?),issues] and thanks

[Rails] Access block scope from AR object

2012-09-18 Thread andreacfm
I need to create a sort of transaction around some Active Record objects that perform many insert/updates. Example: class MyObject def transaction block @my_var = value self.instance_eval block end end MyObject.new.transaction do Model.create

[Rails] Searching for a gem to manage related records

2012-09-18 Thread Iwan B.
Hi! Is there a gem to easily manage related (belongs_to) records (view and controller)? To easily allow the user to select (if already exist) or add/create a new related record without write lines of code? Thanks! iwan -- Posted via http://www.ruby-forum.com/. -- You received this message

[Rails] Re: multiple modules defining same method included into a class

2012-09-18 Thread Matt Jones
On Monday, 17 September 2012 21:04:58 UTC-4, John Merlino wrote: In Ruby, classes are never closed: you can always add methods to an existing class. This applies to the classes you write as well as the standard, built-in classes. All you have to do is open up a class definition for an

Re: [Rails] gem file showing outdated gems?

2012-09-18 Thread Colin Law
On 17 September 2012 20:51, wragen22 bradwr...@gmail.com wrote: Ok. Something interesting though. I've updated the version in the gemfile. Then when I run bundle update the gem file is then modified and version reverts back to old versions. Gemfile should not be modified when you run bundle

Re: [Rails] PDF file is crashing

2012-09-18 Thread Colin Law
On 18 September 2012 06:32, kiran cy li...@ruby-forum.com wrote: PDF file is crashing in my app because of the images present in the pdf What are you trying to do with the pdf file in your app that makes it crash? which are madeup of polygons so i tried to convert the pdf to images and images

Re: [Rails] pg gem error

2012-09-18 Thread Colin Law
On 18 September 2012 06:29, Saravanan P saravana...@shriramits.com wrote: gem install pg give the following error, please help how can i solve this Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension.

Re: [Rails] pg gem error

2012-09-18 Thread Ashwin Mangale
On Ubuntu, there is one libpq-dev ( which you have installed ) and the other is postgresql-server-dev-version. I think you need both. -Ashwin On Tue, Sep 18, 2012 at 11:11 AM, Saravanan P saravana...@shriramits.comwrote: i already installed postgresql. postgresql-dev i think its not a

[Rails] Unable to send mail

2012-09-18 Thread keerthi priya
Hi all i am trying to send mail but i could not send it and at the end it is redirecting to right page but mail is not receiving. i got this in my log Sent mail to mailid Date: Tue, 18 Sep 2012 19:38:51 +0530 From: To: Subject: fdfdsafsdafdsfsfsdafdsf Mime-Version: 1.0

[Rails] Re: ROR books seem to be out of date

2012-09-18 Thread brian brian
On Saturday, September 15, 2012 4:26:36 PM UTC+1, brian brian wrote: i am trying to get started on ROR but the texts all seem to be out of date as regards samples that wont run on later IDEs such as aptana studio ,rubymine and so on.github examples are also out of date and wont run.

[Rails] Re: Unable to send mail

2012-09-18 Thread Avi
Can you check your spam folder in your mailbox ? On Tuesday, September 18, 2012 8:05:32 PM UTC+5:30, keerthi priya wrote: Hi all i am trying to send mail but i could not send it and at the end it is redirecting to right page but mail is not receiving. i got this in my log Sent mail to

[Rails] Re: ROR books seem to be out of date

2012-09-18 Thread brian brian
routing errors all the time ,cant get past the welcome sign running on rails . in win7 and ubuntu systems latest gems and ruby of course . tried everything i can think of using all the books and online material. nothing past localhost:3000 seems to work ,i just get the routing error despite

Re: [Rails] Re: Unable to send mail

2012-09-18 Thread keerthi priya
yeah i am getting my mails not to my inbox . what should i do to get my mail to inbox On Tue, Sep 18, 2012 at 8:14 PM, Avi aavinash.beh...@gmail.com wrote: Can you check your spam folder in your mailbox ? On Tuesday, September 18, 2012 8:05:32 PM UTC+5:30, keerthi priya wrote: Hi all i am

[Rails] Re: ROR books seem to be out of date

2012-09-18 Thread brian brian
this is a common message Routing Error No route matches [GET] /hello/world -- 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

Re: [Rails] pg gem error

2012-09-18 Thread Saravanan P
Thanks I already installed libpq-dev package and now only i installed postgresql-server-dev-9.1 package. But no luck still same error :( any help! Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension.

Re: [Rails] Re: ROR books seem to be out of date

2012-09-18 Thread Colin Law
On 18 September 2012 15:50, brian brian xis2...@gmail.com wrote: routing errors all the time ,cant get past the welcome sign running on rails Post the url you are trying, the full error message, post routes.rb and the output of rake routes. No-one here is telepathic as far as I am aware.

Re: [Rails] Re: ROR books seem to be out of date

2012-09-18 Thread Peter Hickman
Without knowing what you routing file looks like no one can help you. Type 'rake routes' and see what routes have been defined -- 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] Re: Unable to send mail

2012-09-18 Thread Avi
What is your html content ? Try not to use , # in your html. Hope it works. On Tuesday, September 18, 2012 8:26:19 PM UTC+5:30, keerthi priya wrote: yeah i am getting my mails not to my inbox . what should i do to get my mail to inbox On Tue, Sep 18, 2012 at 8:14 PM, Avi

Re: [Rails] Re: Unable to send mail

2012-09-18 Thread keerthi priya
On Tue, Sep 18, 2012 at 8:30 PM, Avi aavinash.beh...@gmail.com wrote: What is your html content ? Welcome Try not to use , # in your html. i did not get this line Hope it works. On Tuesday, September 18, 2012 8:26:19 PM UTC+5:30, keerthi priya wrote: yeah i am getting my mails not to

[Rails] insert text from a drop down list in a fckeditor textarea

2012-09-18 Thread luca massimini
Hi! I'm trying to do a form with a FCKeditor textarea and a drop down list (not a FCKeditor button!). I would like to insert the selected item of the list into the textarea, at the cursor position. Could anyone help me with the code? Thnks! -- Posted via http://www.ruby-forum.com/. -- You

Re: [Rails] Re: Unable to send mail

2012-09-18 Thread Avi
If there is an extra space, some symbols(which are spam) or any spam words, the mail goes to the spam folder. Try with a sentence(all words). On Tuesday, September 18, 2012 8:37:26 PM UTC+5:30, keerthi priya wrote: On Tue, Sep 18, 2012 at 8:30 PM, Avi aavinas...@gmail.com javascript:wrote:

Re: [Rails] Re: Unable to send mail

2012-09-18 Thread keerthi priya
I have sent a big text but still the same i am getting mail in spam On Tue, Sep 18, 2012 at 8:44 PM, Avi aavinash.beh...@gmail.com wrote: If there is an extra space, some symbols(which are spam) or any spam words, the mail goes to the spam folder. Try with a sentence(all words). On Tuesday,

Re: [Rails] Unable to send mail

2012-09-18 Thread Walter Lee Davis
On Sep 18, 2012, at 11:24 AM, keerthi priya wrote: I have sent a big text but still the same i am getting mail in spam You can't really do anything about spam filters from the sending side, except to make your mail look less spammy. Companies like MailChimp and SendGrid spend millions to

Re: [Rails] Re: Unable to send mail

2012-09-18 Thread Avi
Try adding :- :domain = gmail.com in your mailer setting. you may modify your method In user.rb :- def email UserMailer.email(self).deliver end In usermailer.rb :- def email(user) @user = user mail(:to = user.email, :subject = Welcome!!) end On Tuesday, September 18, 2012

Re: [Rails] Re: Unable to send mail

2012-09-18 Thread Avi
may be you can try giving a meaningful subject to the email. On Tuesday, September 18, 2012 9:05:54 PM UTC+5:30, Avi wrote: Try adding :- :domain = gmail.com in your mailer setting. you may modify your method In user.rb :- def email UserMailer.email(self).deliver end In

[Rails] Re: gem file showing outdated gems?

2012-09-18 Thread wragen22
Gemfile here. It looks like it's no longer changing. source http://rubygems.org; gem 'rails', '3.2.8' # Bundle edge Rails instead: # gem 'rails', :git = 'git://github.com/rails/rails.git' gem 'sqlite3' gem 'json' # Gems used only for assets and not required # in production

Re: [Rails] Re: Unable to send mail

2012-09-18 Thread keerthi priya
i tried that also but still the same. On Tue, Sep 18, 2012 at 9:12 PM, Avi aavinash.beh...@gmail.com wrote: may be you can try giving a meaningful subject to the email. On Tuesday, September 18, 2012 9:05:54 PM UTC+5:30, Avi wrote: Try adding :- :domain = gmail.com in your mailer setting.

[Rails] undefined method `to_sym' for nil:NilClass

2012-09-18 Thread Shandy Nantz
Hi all, I am trying to upgrade my rails 2 app to 3 and am getting this error when trying to login: NoMethodError in AuthenticateController#authenticate undefined method `to_sym' for nil:NilClass The stack trace is: activerecord (3.2.2) lib/active_record/validations/uniqueness.rb:26:in

[Rails] best practices for Rails serving RESTful JSON services for use by AngularJS, Ember.js, etc.

2012-09-18 Thread gsw
I've been writing a gem to implement and extend common controller functionality so that Rails can be used with Javascript frameworks like AngularJS (which we are using), Ember.js, etc. in such a way that the user doesn't have to tweak a a bunch of rails g controller boilerplate code to provide

Re: [Rails] undefined method `to_sym' for nil:NilClass

2012-09-18 Thread Dave Aronson
On Tue, Sep 18, 2012 at 12:05 PM, Shandy Nantz li...@ruby-forum.com wrote: NoMethodError in AuthenticateController#authenticate undefined method `to_sym' for nil:NilClass ... About halfway down I notice an error directing me to my User model in method 'authenticate' and on line 69. When I go

[Rails] Re: best practices for Rails serving RESTful JSON services for use by AngularJS, Ember.js, etc.

2012-09-18 Thread gsw
On Tuesday, September 18, 2012 12:28:00 PM UTC-4, gsw wrote: rescue puts $!.inspect, $@ # TODO: add support for other formats respond_to do |format| format.json { render json: {errors: [$!.message]}, status: (:internal_server_error) } end end

[Rails] Re: best practices for Rails serving RESTful JSON services for use by AngularJS, Ember.js, etc.

2012-09-18 Thread gsw
On Tuesday, September 18, 2012 12:28:00 PM UTC-4, gsw wrote: respond_with(errors: [@company.errors], location: users_url, status: unprocessable_entity) Ugh. Didn't need the array around @company.errors either. respond_with(errors: @company.errors, location: users_url, status:

[Rails] Koans question : Don't understand the answers

2012-09-18 Thread roelof
Hello, Im trying to learn ruby by using koans. Now I have to fill in this part. def test_some_system_objects_always_have_the_same_id assert_equal --, false.object_id assert_equal --, true.object_id assert_equal --, nil.object_id end According to the answers I have to fill in

[Rails] Re: best practices for Rails serving RESTful JSON services for use by AngularJS, Ember.js, etc.

2012-09-18 Thread gsw
On Tuesday, September 18, 2012 12:28:00 PM UTC-4, gsw wrote: respond_with(errors: [@company.errors], location: users_url, status: unprocessable_entity) Sorry, a lot of status symbols missing the preceding colon. Also, I think the location only needs to be set for HTTP status codes

[Rails] Re: Koans question : Don't understand the answers

2012-09-18 Thread Robert Walker
Roelof Wobben wrote in post #1076512: Hello, Im trying to learn ruby by using koans. Now I have to fill in this part. def test_some_system_objects_always_have_the_same_id assert_equal --, false.object_id assert_equal --, true.object_id assert_equal --, nil.object_id end

[Rails] Re: Unable to install gem on mountain lion?

2012-09-18 Thread Timster
In new versions of XCode you need to specifically install the command line tools for this to work. Check here for a screenshot of how to: http://www.zlu.me/blog/2012/02/21/install-native-ruby-gem-in-mountain-lion-preview/ -- You received this message because you are subscribed to the Google

[Rails] Re: Unable to install gem on mountain lion?

2012-09-18 Thread wragen22
Hm.. Interesting. I went and installed the extra extension into xcode. but now getting a different output. Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb

[Rails] Re: Unable to install gem on mountain lion?

2012-09-18 Thread wragen22
Ah...fixed with homebrew and these instructions here. http://cczona.com/blog/2012/07/fix-for-make-usrbingcc-4-2-no-such-file-or-directory/ Thanks! -- 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] Re: Re: Find the largest value of given 3 values

2012-09-18 Thread roh
if we want to get the highest 3 values , then how can we write the code for that .? On Tue, Sep 18, 2012 at 12:34 PM, Manoj M. li...@ruby-forum.com wrote: rovin varshney wrote in post #1076418: simply put all numbers in array and call max method. a=[2,3,4] a.max yes Rovin ruby way :)

[Rails] NoMethodError with rake db:migrate

2012-09-18 Thread jose ramirez
Hi! First of all, this is my first application on Rails, and i'm stuck at a migration. i created a demo app (the demo_app from michael hartl's tutorial) as usual: rails new demo_app, rails generate scaffold User name:string email:string, and when i do rake db:migrate, this stack appears: rake

[Rails] Rails Thread Starvation

2012-09-18 Thread Carl
Hi! I was hoping to receive some help on a difficult matter - I have tried a lot already. http://stackoverflow.com/questions/12468781/rails-thread-starvation That's the link, I hope it is ok to link there. Thanks! Carl -- You received this message because you are subscribed to the Google

[Rails] Re: STI Devise, remove sign up for admin

2012-09-18 Thread Jim Smith
A little late to the party, but I just ran into the same issue. I have my User model set up, and my AdminUser model is inheriting from the User model. Technically, you cannot 'remove' the 'registerable' module from your Admin model without removing it from the User model. We can still set up

[Rails] Re: Cannot redirect to nil! - basic MVC operation

2012-09-18 Thread rodrigo coutinho
well you are not using rest routes. it should look like : yourapp/tasks/4 rails would understand 4 as the param . On 17 set, 15:05, Hassan Schroeder hassan.schroe...@gmail.com wrote: On Mon, Sep 17, 2012 at 9:31 AM, Bogdan M. li...@ruby-forum.com wrote: controller: def random       @task

[Rails] Re: Creating a link_to from a collection_select

2012-09-18 Thread Crispin Schäffler
Hey Brian, currently im a bit tired so im not able to write this code for you. however, here is what i would do: 1. app/views/tasks/show.html.erb should be to view the task given by the id (tasks/1). so you shouldn't do any edit on that article on the show page itself. this leads to 2. you

[Rails] Can't modify frozen hash memcached

2012-09-18 Thread Tales Marchesan Chaves
Hi all, I was starting to implement caching with memcached in one of our projects that still uses Rails 2.3 (yes, still). As Rails only caches Active Record objects for one request, I thought of caching them on memcached. For that, I've defined a method that intercepts the find method of Active

[Rails] Re: Re: belongs_to aliases

2012-09-18 Thread Robert Walker
Panayotis Matsinopoulos wrote in post #1076115: You may be right, but I have found a lot of other posts on Internet that they complain about belongs_to. It does not bear the correct meaning for all cases. For example: class Product belongs_to :status end .Awful. No, the Product

Re: [Rails] Koans question : Don't understand the answers

2012-09-18 Thread Christopher R. Maden
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/18/2012 01:23 PM, roelof wrote: But how can I normally know the id of a object ? Meditate on the name of the test. ~Chris - -- Chris Maden, text nerd URL: http://crism.maden.org/ LIVE FREE: vote for Gary Johnson, Libertarian for President.

Re: [Rails] Koans question : Don't understand the answers

2012-09-18 Thread rubyonrailsx
As far as i know, ruby use memory location to generate object's id, normally any dynamic objects(runtime generate objects) will have different object_id, for example foo.object_id not equal with foo.object_id. But, any object like number, true, false ,nil and symbol all have fixed object_id

[Rails] Re: Re: Re: Find the largest value of given 3 values

2012-09-18 Thread 7stud --
roh wrote in post #1076535: if we want to get the highest 3 values , then how can we write the code for that .? data = [10, 20, 70, 60, 40, 30] ordered_data = data.sort_by {|num| -num} p ordered_data p ordered_data[0..2] --output:-- [70, 60, 40, 30, 20, 10] [70, 60, 40] -- Posted via

Re: [Rails] Koans question : Don't understand the answers

2012-09-18 Thread roelof
Everybody thanks for the explanation. I have another problem. On this : def test_accessing_hashes_with_fetch hash = { :one = uno } assert_equal uno, hash.fetch(:one) assert_raise(Class: IndexError Message: key not found ---Backtrace--- ./about_hashes.rb:27:in `fetch'