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
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
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
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
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
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
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
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
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
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.
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
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
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.
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
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
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
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
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.
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.
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
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
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
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
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:
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,
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
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
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
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
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.
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
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
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
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
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:
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
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
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
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
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
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
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 :)
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
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
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
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
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
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
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
-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.
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
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
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'
53 matches
Mail list logo