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

2012-09-17 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.  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 of finding the largest value.*
>
> if a,b and c are numbers
>
> if(a>b)
> {
> if(a>c)
> {("a is largest")}
> else
> {("c is largest")}
> }
> else
> {
> if(b>c)
> {("b is largest")}
> else
> {("c is largest")}
> }
>
> --
> 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 email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




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

2012-09-17 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(a>b)
{
if(a>c)
{("a is largest")}
else
{("c is largest")}
}
else
{
if(b>c)
{("b is largest")}
else
{("c is largest")}
}

-- 
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 email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Find the largest value of given 3 values

2012-09-17 Thread Maddy
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.*


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/uQKvdH2DJCAJ.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] pg gem error

2012-09-17 Thread Saravanan P
i already installed postgresql. "postgresql-dev" i think its not a package,
did you mean "libpq-dev". if yes i already installed that too. i am using
ubuntu 12.04. In my error

checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no

saying PQconnectdb() in -lpq... no, which mean?


On Tue, Sep 18, 2012 at 11:01 AM, Christopher R. Maden wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 09/18/2012 01:29 AM, Saravanan P 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.
>
> The pg gem is only a way to communicate with the Postgres server; make
> sure you have postgresql and postgresql-dev installed on your system
> (with Linux, there should be apt or rpm packages available; not sure
> about Windows).
>
> ~Chris
> - --
> Chris Maden, text nerd  http://crism.maden.org/ >
> LIVE FREE: vote for Gary Johnson, Libertarian for President.
>  http://garyjohnson2012.com/ >  http://lp.org/ >
> GnuPG fingerprint: DB08 CF6C 2583 7F55 3BE9  A210 4A51 DBAC 5C5C 3D5E
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
>
> iQEcBAEBAgAGBQJQWAc0AAoJEEpR26xcXD1etjkH/R+M6ywCsMptwDpG2NvQxp0I
> QULmxdflzw0V5/c50trpd+DFo3gkQuKLuMchTZ6akcckp7+IFUy8yd1sPAfheXOF
> UympBgajZMYeqv1EGSJEGq0XKtR9a28s97NxPzxzddbqtoswmxnl9hgLVunuK2il
> 135FUGxxRgRbJhbfmbCYzR+a5r32FxP+lc8fODJCHEWhQhyxlfJryTTHW6YXp88r
> lDWN545LYUMmL/4rupI45vusIxeom70wrMFeXug5qdk1urkL/nxTAR8kG1Zp2+8w
> 4NlrRckzbWutjJNTMK3NuPQTOcWFXeg7jjJUY4CJDtF3zr6NEdBSwvVwqYoCRh0=
> =34RQ
> -END PGP SIGNATURE-
>
> --
> 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 more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Regards by
Saravanan.P

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] How to read Microsoft document file in ruby on rails ?

2012-09-17 Thread rovin varshney
Hello Everyone,
   Thanks everyone.Finally got a solution while searching things that you
all had explained.
   There is a docx gem for parsing docx file and docx-html for convert it
into HTML.

   require 'docx'

d = Docx::Document.open('example.docx')d.each_paragraph do |p|
  puts dend

and for the docx file stored on s3 amazon.

Docx::Document.open(open('http://S3-URL/original.docx',:ssl_verify_mode =>
OpenSSL::SSL::VERIFY_NONE))

A big Thanks to All.


On Sun, Sep 16, 2012 at 9:42 PM, Walter Lee Davis wrote:

> For a start, here's the man page for catdoc, which you will need to
> install.
>
> http://linux.die.net/man/1/catdoc
>
> Then, read up on using the system() or backtick operators in a Ruby script
> to engage it. You'll need to have a path to the file you want to process,
> which is highly dependent on the system you're using to store the files. In
> Paperclip, I made this processor to extract text from PDF files (pdftotext
> is part of the same collection of utilities as catdoc, I believe):
>
> #lib/paperclip_processors/text.rb
>
> module Paperclip
>   # Handles extracting plain text from PDF file attachments
>   class Text < Processor
>
> attr_accessor :whiny
>
> # Creates a Text extract from PDF
> def make
>   src = @file
>   dst = Tempfile.new([@basename, 'txt'].compact.join("."))
>   command = <<-end_command
> "#{ File.expand_path(src.path) }"
> "#{ File.expand_path(dst.path) }"
>   end_command
>
>   begin
> success = Paperclip.run("/usr/bin/pdftotext -nopgbrk",
> command.gsub(/\s+/, " "))
> Rails.logger.info "Processing #{src.path} to #{dst.path} in the
> text processor."
>   rescue PaperclipCommandLineError
> raise PaperclipError, "There was an error processing the text for
> #{@basename}" if @whiny
>   end
>   dst
> end
>   end
> end
>
> Depending on how you are uploading your files, your mileage may vary. At
> the very simplest, the command would be
>
> text_contents = system('/usr/bin/catdoc /root/relative/path/to/file.doc')
>
> But that's hopelessly naive and will blow up on any error.
>
> Walter
>
>
> On Sep 16, 2012, at 6:16 AM, rovin varshney wrote:
>
> >
> > Hi  Walter Lee Davis , Paul
> >
> >  Please can u give some code snipet or give some more
> clarification about parsing doc file.
> >
> > On Sat, Sep 15, 2012 at 7:37 PM, Scott Ribe 
> wrote:
> > On Sep 15, 2012, at 7:27 AM, Paul wrote:
> >
> > > The docx format is actually pretty simple...
> >
> > You are really cruel to toy with him like that ;-)
> >
> >
> > --
> > Scott Ribe
> > scott_r...@elevated-dev.com
> > http://www.elevated-dev.com/
> > (303) 722-0567 voice
> >
> >
> >
> >
> > --
> > 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 more options, visit https://groups.google.com/groups/opt_out.
> >
> >
> >
> >
> > --
> > 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 more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
> --
> 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 more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




[Rails] PDF file is crashing

2012-09-17 Thread kiran cy
PDF file is crashing in my app because of the images present in the pdf
which are madeup of polygons so i tried to convert the pdf to images and
images back to pdf but there is drastic change in the quality of pdf
so i tried to view the pdf in browser and to convert the html to pdf.
Is it possible to convert the pdf to html

-- 
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 email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] pg gem error

2012-09-17 Thread Christopher R. Maden
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 09/18/2012 01:29 AM, Saravanan P 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.

The pg gem is only a way to communicate with the Postgres server; make
sure you have postgresql and postgresql-dev installed on your system
(with Linux, there should be apt or rpm packages available; not sure
about Windows).

~Chris
- -- 
Chris Maden, text nerd  http://crism.maden.org/ >
LIVE FREE: vote for Gary Johnson, Libertarian for President.
 http://garyjohnson2012.com/ >  http://lp.org/ >
GnuPG fingerprint: DB08 CF6C 2583 7F55 3BE9  A210 4A51 DBAC 5C5C 3D5E
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQWAc0AAoJEEpR26xcXD1etjkH/R+M6ywCsMptwDpG2NvQxp0I
QULmxdflzw0V5/c50trpd+DFo3gkQuKLuMchTZ6akcckp7+IFUy8yd1sPAfheXOF
UympBgajZMYeqv1EGSJEGq0XKtR9a28s97NxPzxzddbqtoswmxnl9hgLVunuK2il
135FUGxxRgRbJhbfmbCYzR+a5r32FxP+lc8fODJCHEWhQhyxlfJryTTHW6YXp88r
lDWN545LYUMmL/4rupI45vusIxeom70wrMFeXug5qdk1urkL/nxTAR8kG1Zp2+8w
4NlrRckzbWutjJNTMK3NuPQTOcWFXeg7jjJUY4CJDtF3zr6NEdBSwvVwqYoCRh0=
=34RQ
-END PGP SIGNATURE-

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




[Rails] pg gem error

2012-09-17 Thread Saravanan P
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.

/home/saravanan/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/saravanan/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib


Gem files will remain installed in 
/home/saravanan/.rvm/gems/ruby-1.9.3-p194/gems/pg-0.14.1 for inspection.
Results logged to 
/home/saravanan/.rvm/gems/ruby-1.9.3-p194/gems/pg-0.14.1/ext/gem_make.out

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/MPS_zdkBAPcJ.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Re: Nginx + Phusion Passenger 3 problem with "504 Gateway time-out"

2012-09-17 Thread Benjamin Iandavid Rodriguez
Many times I find best to use Nginx + unicorn as the app server, you might
give that a try.

2012/9/17 Sebastião Giacheto F. Júnior 

> Thanks for your reply, but there's actually no need for speed increase
> or scalability whatsoever so there's no need to setup a background job
> queue system. If I cannot solve this problem, I'll probably try thin
> instead of passenger. I'm actually curious about the solution of this
> issue :D
>
> On Sep 18, 1:22 am, Benjamin Iandavid Rodriguez 
> wrote:
> > For actions that take a lot of time I suggest to send it to the
> background
> > if possible, you can use:
> >   - resquehttps://github.com/defunkt/resque
> >   - sideqikhttp://mperham.github.com/sidekiq/
> >
> > Regards
> >
> > 2012/9/17 Sebastião Giacheto F. Júnior 
> >
> >
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > I have a Rails 3.2 app. There is a specific request that takes a long
> > > time to execute. The context is, the user uploads a pdf, and then we
> > > have some processing through carrierwave + rmagick that generate a
> > > jpeg from the first page of the document. Everything works in dev mode
> > > using both webrick and thin. The problem happens on the prod
> > > environment with Nginx + Passenger.
> >
> > > The request takes a lot of time and the browser is redirected to a
> > > "504 Gateway time-out". At this point, the file was already sent, but
> > > it's being processed (the pdf manipulation task really takes time). I
> > > found several threads with solutions like this:
> >
> > >https://groups.google.com/forum/?fromgroups=#!topic/phusion-passenger.
> ..
> > > that basically consists in patching the hardcoded timeout values on
> > > the passenger source before compiling the module.
> >
> > > There is actually no error on the request and the manipulation of the
> > > files itself. After a while, the work on the server is finished
> > > without any bad behaviour. The processed jpeg is served by the app as
> > > nothing bad has actually hapened. This evidence summed up with the
> > > fact that everything works in dev mode, points to a nginx+passenger
> > > problem.
> >
> > > Anyone has a more clearer solution to the passenger+nginx
> > > configuration scheme?
> >
> > > --
> > > 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 more options, visithttps://groups.google.com/groups/opt_out.
>
> --
> 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 more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Nginx + Phusion Passenger 3 problem with "504 Gateway time-out"

2012-09-17 Thread Sebastião Giacheto F . Júnior
Thanks for your reply, but there's actually no need for speed increase
or scalability whatsoever so there's no need to setup a background job
queue system. If I cannot solve this problem, I'll probably try thin
instead of passenger. I'm actually curious about the solution of this
issue :D

On Sep 18, 1:22 am, Benjamin Iandavid Rodriguez 
wrote:
> For actions that take a lot of time I suggest to send it to the background
> if possible, you can use:
>   - resquehttps://github.com/defunkt/resque
>   - sideqikhttp://mperham.github.com/sidekiq/
>
> Regards
>
> 2012/9/17 Sebastião Giacheto F. Júnior 
>
>
>
>
>
>
>
> > Hi,
>
> > I have a Rails 3.2 app. There is a specific request that takes a long
> > time to execute. The context is, the user uploads a pdf, and then we
> > have some processing through carrierwave + rmagick that generate a
> > jpeg from the first page of the document. Everything works in dev mode
> > using both webrick and thin. The problem happens on the prod
> > environment with Nginx + Passenger.
>
> > The request takes a lot of time and the browser is redirected to a
> > "504 Gateway time-out". At this point, the file was already sent, but
> > it's being processed (the pdf manipulation task really takes time). I
> > found several threads with solutions like this:
>
> >https://groups.google.com/forum/?fromgroups=#!topic/phusion-passenger...
> > that basically consists in patching the hardcoded timeout values on
> > the passenger source before compiling the module.
>
> > There is actually no error on the request and the manipulation of the
> > files itself. After a while, the work on the server is finished
> > without any bad behaviour. The processed jpeg is served by the app as
> > nothing bad has actually hapened. This evidence summed up with the
> > fact that everything works in dev mode, points to a nginx+passenger
> > problem.
>
> > Anyone has a more clearer solution to the passenger+nginx
> > configuration scheme?
>
> > --
> > 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 more options, visithttps://groups.google.com/groups/opt_out.

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




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

2012-09-17 Thread John Merlino
So it does appear that the ActionController::Rendering module does
include AbstractController::Rendering, which means a call to super in
the render method of  ActionController::Rendering will in turn call
the render method of  AbstractController::Rendering. What makes this
somewhat confusing is that ActionController::Rendering is included in
ActionController::Base, but  AbstractController::Rendering is included
in ActionController::Base as well. Yet  AbstractController::Rendering
is also included in ActionController::Rendering. Wouldn't
AbstractController::Rendering being included
ActionController::Rendering and the fact that
ActionController::Rendering is included in ActionController::Base make
AbstractController::Rendering being included in ActionController::Base
redundant?

On Sep 17, 9:04 pm, 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 existing class, and the new contents you specify
> will be added to whatever's there. In the same regard, if module is
> used with the name of a pre-existing module that module is re-opened.
> If a method is defined in a re-opened module with the same name as a
> pre-existing method in the same module the old method is overwritten
> with the new. And, of course, modules can be made immutable,
> effectively preventing them from being reopened by freezing the module
> object. Frozen modules raise RuntimeErrors when methods are defined,
> or variables manipulated, in their context.
>
> When you include a module in a class, without a prefix (prefix meaning
> something like this: AbstractController::Layouts), then ruby searches
> for the module of that name within the scope of the current module
> wrapping the class that the include was called in.
>
> So, for example:
>
> module ActionController
>   class Base
>     include Rendering
>
> Since we "include Rendering" within the scope of the Base class
> object, ruby first looksup the constant Rendering, that is, looking
> for a module named Rendering in the ActionController namespace, since
> that is the namesapce that Base is defined in???
>
> Well, ActionController module does define a module named Rendering:
>
> module ActionController
>   module Rendering
>      def render(*args)
>       raise ::AbstractController::DoubleRenderError if response_body
>       super
>       self.content_type ||= Mime[lookup_context.rendered_format].to_s
>       response_body
>     end
>
> So now the method render(*args) is included in the Base class as an
> instance method. So when we call, for example, (hypothetically)
> ActionView::Base.new.render :action => "my_action", :layout => false,
> ActionView::Base is instantiated and we invoke the render instance
> method, and since no render method is declared in the Base class
> context, ruby scope chain does lookup into the module Rendering and
> finds the method so calls it. Now, as you may know, it's possible to
> pass multiple kinds of arguments to render, depending on whether you
> want to render a template or a partial or file, etc. The * syntax does
> the job here, allowing you vary the number of arguments passed. It
> checks if there is already a response to the request, and raises an
> Exception, if so. Otherwise, it calls super.
>
> During this super call, I got a little confused. In
> ActionController::Base, there is another module included called
> AbstractController::Layouts. Layouts in turn includes a module called
> Rendering. Since there is a Rendering module within the
> AbstractController namespace, it is found, and it indeed contains a
> method called render.
>
>    def render(*args, &block)
>       options = _normalize_render(*args, &block)
>       self.response_body = render_to_body(options)
>     end
>
> And because render is included in Layouts, it's included as an
> instance method, and because Layouts was included in
> ActionController::Base, that render method utlimately makes its way up
> to the Base class. Now we have two modules
> (ActionController::Rendering and AbstractController::Rendering that
> are including this method into Base. So why doesn't one of them get
> overwritten? Why does the call to super work?

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Nginx + Phusion Passenger 3 problem with "504 Gateway time-out"

2012-09-17 Thread Benjamin Iandavid Rodriguez
For actions that take a lot of time I suggest to send it to the background
if possible, you can use:
  - resque https://github.com/defunkt/resque
  - sideqik http://mperham.github.com/sidekiq/

Regards

2012/9/17 Sebastião Giacheto F. Júnior 

> Hi,
>
> I have a Rails 3.2 app. There is a specific request that takes a long
> time to execute. The context is, the user uploads a pdf, and then we
> have some processing through carrierwave + rmagick that generate a
> jpeg from the first page of the document. Everything works in dev mode
> using both webrick and thin. The problem happens on the prod
> environment with Nginx + Passenger.
>
> The request takes a lot of time and the browser is redirected to a
> "504 Gateway time-out". At this point, the file was already sent, but
> it's being processed (the pdf manipulation task really takes time). I
> found several threads with solutions like this:
>
> https://groups.google.com/forum/?fromgroups=#!topic/phusion-passenger/LOEb7x-nAy0
> that basically consists in patching the hardcoded timeout values on
> the passenger source before compiling the module.
>
> There is actually no error on the request and the manipulation of the
> files itself. After a while, the work on the server is finished
> without any bad behaviour. The processed jpeg is served by the app as
> nothing bad has actually hapened. This evidence summed up with the
> fact that everything works in dev mode, points to a nginx+passenger
> problem.
>
> Anyone has a more clearer solution to the passenger+nginx
> configuration scheme?
>
> --
> 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 more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




[Rails] Nginx + Phusion Passenger 3 problem with "504 Gateway time-out"

2012-09-17 Thread Sebastião Giacheto F . Júnior
Hi,

I have a Rails 3.2 app. There is a specific request that takes a long
time to execute. The context is, the user uploads a pdf, and then we
have some processing through carrierwave + rmagick that generate a
jpeg from the first page of the document. Everything works in dev mode
using both webrick and thin. The problem happens on the prod
environment with Nginx + Passenger.

The request takes a lot of time and the browser is redirected to a
"504 Gateway time-out". At this point, the file was already sent, but
it's being processed (the pdf manipulation task really takes time). I
found several threads with solutions like this:
https://groups.google.com/forum/?fromgroups=#!topic/phusion-passenger/LOEb7x-nAy0
that basically consists in patching the hardcoded timeout values on
the passenger source before compiling the module.

There is actually no error on the request and the manipulation of the
files itself. After a while, the work on the server is finished
without any bad behaviour. The processed jpeg is served by the app as
nothing bad has actually hapened. This evidence summed up with the
fact that everything works in dev mode, points to a nginx+passenger
problem.

Anyone has a more clearer solution to the passenger+nginx
configuration scheme?

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




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

2012-09-17 Thread John Merlino
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 existing class, and the new contents you specify
will be added to whatever's there. In the same regard, if module is
used with the name of a pre-existing module that module is re-opened.
If a method is defined in a re-opened module with the same name as a
pre-existing method in the same module the old method is overwritten
with the new. And, of course, modules can be made immutable,
effectively preventing them from being reopened by freezing the module
object. Frozen modules raise RuntimeErrors when methods are defined,
or variables manipulated, in their context.

When you include a module in a class, without a prefix (prefix meaning
something like this: AbstractController::Layouts), then ruby searches
for the module of that name within the scope of the current module
wrapping the class that the include was called in.

So, for example:

module ActionController
  class Base
include Rendering

Since we "include Rendering" within the scope of the Base class
object, ruby first looksup the constant Rendering, that is, looking
for a module named Rendering in the ActionController namespace, since
that is the namesapce that Base is defined in???

Well, ActionController module does define a module named Rendering:

module ActionController
  module Rendering
 def render(*args)
  raise ::AbstractController::DoubleRenderError if response_body
  super
  self.content_type ||= Mime[lookup_context.rendered_format].to_s
  response_body
end


So now the method render(*args) is included in the Base class as an
instance method. So when we call, for example, (hypothetically)
ActionView::Base.new.render :action => "my_action", :layout => false,
ActionView::Base is instantiated and we invoke the render instance
method, and since no render method is declared in the Base class
context, ruby scope chain does lookup into the module Rendering and
finds the method so calls it. Now, as you may know, it's possible to
pass multiple kinds of arguments to render, depending on whether you
want to render a template or a partial or file, etc. The * syntax does
the job here, allowing you vary the number of arguments passed. It
checks if there is already a response to the request, and raises an
Exception, if so. Otherwise, it calls super.

During this super call, I got a little confused. In
ActionController::Base, there is another module included called
AbstractController::Layouts. Layouts in turn includes a module called
Rendering. Since there is a Rendering module within the
AbstractController namespace, it is found, and it indeed contains a
method called render.

   def render(*args, &block)
  options = _normalize_render(*args, &block)
  self.response_body = render_to_body(options)
end

And because render is included in Layouts, it's included as an
instance method, and because Layouts was included in
ActionController::Base, that render method utlimately makes its way up
to the Base class. Now we have two modules
(ActionController::Rendering and AbstractController::Rendering that
are including this method into Base. So why doesn't one of them get
overwritten? Why does the call to super work?






-- 
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 more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Re: Creating a link_to from a collection_select

2012-09-17 Thread Jim Ruther Nill
On Tue, Sep 18, 2012 at 7:16 AM, Brian Ekmark wrote:

> Shameless bump ... can anyone help on this?
>
> On Thursday, September 13, 2012 9:32:34 AM UTC-5, Brian Ekmark wrote:
>
>> I want to be able to change one attribute of a link_to to be what is the
>> current selection of the collection_select. And needless to say I can't
>> quite figure it out.
>>
>> app/views/tasks/show.html.erb
>>
>> Who would you like to assign this task to?
>> <%= link_to 'Myself', :controller => 'task_queues', :task_id => @task.id,
>> :action => 'assign_to_me' %> |
>> Assign To:
>> <%= collection_select("assign", "user_id", @users, :id, :full_name )%>
>> <%= link_to 'Assign', :controller =>'task_queues', :task_id => @task.id,
>> :user_id => ## Current Selection of the collection_select ##, :action =>
>> 'assign_to_other' %>
>>
>> This action brings it across to another controller/model where I write
>> the results to the task_queues database.
>>
>> Any insight or assistance in this would be greatly apprecaited.
>>
>
You need to use javascript.  In jquery that would be

$('#assign_user_id').change(function() {
  $(this).next().attr('href', '/task_queues/#{@task.id}/assign_to_other/' +
$('#assign_user_id :selected').val()

I'm not sure how your routes is setup so I'm not sure if I got your url
right.


>> Thanks,
>>
>> Brian
>>
>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/k8K_pbExS-QJ.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
-
visit my blog at http://jimlabs.heroku.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 email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Unable to install gem on mountain lion?

2012-09-17 Thread wragen22
Hello,
I'm trying to install a specific gem but getting this error message below.

ERROR:  Error installing nokogiri:
> ERROR: Failed to build gem native extension.
> 
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby 
> extconf.rb
> mkmf.rb can't find header files for ruby at 
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
>
> Gem files will remain installed in 
> /Library/Ruby/Gems/1.8/gems/nokogiri-1.5.5 for inspection.
> Results logged to 
> /Library/Ruby/Gems/1.8/gems/nokogiri-1.5.5/ext/nokogiri/gem_make.out
>
>
I've seen that some folks have resolved this issue by reinstalling the new 
version of x-code.  Which I did - but no avail.
Any tips?

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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/94iDDM_e_ooJ.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Creating a link_to from a collection_select

2012-09-17 Thread Brian Ekmark
Shameless bump ... can anyone help on this?

On Thursday, September 13, 2012 9:32:34 AM UTC-5, Brian Ekmark wrote:

> I want to be able to change one attribute of a link_to to be what is the 
> current selection of the collection_select. And needless to say I can't 
> quite figure it out.
>  
> app/views/tasks/show.html.erb
>  
> Who would you like to assign this task to?
> <%= link_to 'Myself', :controller => 'task_queues', :task_id => @task.id, 
> :action => 'assign_to_me' %> |
> Assign To:
> <%= collection_select("assign", "user_id", @users, :id, :full_name )%>
> <%= link_to 'Assign', :controller =>'task_queues', :task_id => @task.id, 
> :user_id => ## Current Selection of the collection_select ##, :action => 
> 'assign_to_other' %>
>  
> This action brings it across to another controller/model where I write the 
> results to the task_queues database. 
>  
> Any insight or assistance in this would be greatly apprecaited.
>  
> Thanks,
>  
> Brian
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/k8K_pbExS-QJ.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] gem file showing outdated gems?

2012-09-17 Thread wragen22
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.

On Monday, September 17, 2012 12:48:44 PM UTC-7, Jordon Bedwell wrote:
>
> On Mon, Sep 17, 2012 at 2:44 PM, wragen22 > 
> wrote: 
> > For some reason my gem file in my rails app shows outdated versions of 
> gems 
> > even though i've updated. 
> > 
> > Ie. gem 'uglifier', '>= 1.0.3' 
> > 
> > However after running bundle update my terminal showed 
> > 
> > Using uglifier (1.3.0) 
> > 
> > Is there a dependency path that is incorrect? How can I make sure my 
> gemfile 
> > is using the correct versions? 
>
> You update the version string in the Gemfile.  Just because you run a 
> bundle update does not mean that bundler will alter your Gemfile. 
> Actually that would be a violation of most principles if it did...that 
> is why it has it's own lock file so it does not violate reasonable 
> expectations from developers. 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/Qw09WNu2VHQJ.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] gem file showing outdated gems?

2012-09-17 Thread Jordon Bedwell
On Mon, Sep 17, 2012 at 2:44 PM, wragen22  wrote:
> For some reason my gem file in my rails app shows outdated versions of gems
> even though i've updated.
>
> Ie. gem 'uglifier', '>= 1.0.3'
>
> However after running bundle update my terminal showed
>
> Using uglifier (1.3.0)
>
> Is there a dependency path that is incorrect? How can I make sure my gemfile
> is using the correct versions?

You update the version string in the Gemfile.  Just because you run a
bundle update does not mean that bundler will alter your Gemfile.
Actually that would be a violation of most principles if it did...that
is why it has it's own lock file so it does not violate reasonable
expectations from developers.

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




[Rails] gem file showing outdated gems?

2012-09-17 Thread wragen22
 

For some reason my gem file in my rails app shows outdated versions of gems 
even though i've updated.

Ie. gem 'uglifier', '>= 1.0.3'

However after running bundle update my terminal showed 

Using uglifier (1.3.0) 

Is there a dependency path that is incorrect? How can I make sure my 
gemfile is using the correct versions?

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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/4ZPSWEl27dIJ.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Biometrics fingerprint scanner in RoR? Is it possible? and how?

2012-09-17 Thread Jim

>
> This is not a rails question at all. It's a web browser & fingerprint 
> scanner question.  


> Is there any way to access fingerprint scanner results from a web browser? 
> If so, using RoR to handle the backend of the web application is no 
> different than any other web app. If not, rails certainly can't help you 
> around that roadblock. 


Not technically a web browser question, as you could use a native app to 
handle the interface with the user, the fingerprint scanner, and the 
backend.  However, as Rails is only the backend, there is still no way this 
can be construed to be a Rails question.

Jim

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/Aedcl3HA9R8J.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: inheriting from StandardError

2012-09-17 Thread John Merlino
So we must build an entire class just for sake of more specific rescue
statements:

class MyError < StandardError
end

try_counter = 0
begin
 try_counter += 1
 puts 'Here 1'
 raise MyError.new "Text" unless try_counter > 5
 puts 'Here 2'
rescue MyError
 puts 'Here 3 - MyError encountered'
 retry
rescue StandardError
 puts "Here 4 - Other error encountered (#{$!.inspect})" +
caller.inspect
 raise
else
 puts 'Here 5 - No errors'
ensure
 puts 'Here 6 - Always done'
end


On Sep 16, 4:02 pm, Frederick Cheung 
wrote:
> On Sunday, September 16, 2012 7:57:44 PM UTC+1, John Merlino wrote:
>
> >   class ActionNotFound < StandardError #:nodoc:
> >   end
>
> > unless action_name = method_for_action(action_name)
> >   raise ActionNotFound, "The action '#{action}' could not be found for
> > #{self.class.name}"
> > end
>
> > But why even bother to create the subclasses (which as shown above,
> > have no definition of themselves), when substituting ActionNotFound
> > with StandardError during the raise call will have the same effect.
>
> Because it doesn't have the same effect. Raising specific subclasses allows
> you to write targeted rescue clauses rather than rescuing indiscriminately.
>
> Fred

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




[Rails] is Phusion Passenger really supported?

2012-09-17 Thread Scott Ribe
And if so, is there a better place than the google group?

I have installed twice on OS X 10.6.8 (with nginx, using rvm), once on a dev 
system where I have had absolutely no problem, and once on a test system where 
PassengerHelperAgent crashes and results in the app being inaccessible every 
few requests--sometimes it doesn't even serve a single request before dying.

I posted in the google group on Aug 30th, and have gotten 0 responses. I did 
use google first, and found a very few similar-sounding reports, but no 
resolution.

Passenger Phusion 3.0.17, ruby 1.9.3p194, nginx 1.2.1, rails 3.2.6. I'm 
considering just ripping everything out and reinstalling, but considering that 
I tried to follow the same procedure on both installs and I have this problem, 
I don't know whether that could make a difference, nor can I think of anything 
different to try during install.


-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




-- 
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 more options, visit https://groups.google.com/groups/opt_out.




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

2012-09-17 Thread Hassan Schroeder
On Mon, Sep 17, 2012 at 9:31 AM, Bogdan M.  wrote:

> controller:
>
> def random
>   @task = Task.find(rand(Task.first.id..Task.last.id))
>   #  REMOVE - UNNECESSARY render "random"
> end
>
> random.html.erb
><%= @task %>   # i want it to make it work, if i pass manually
> lets #say `../random/1` lets say as an example it works it shows me the
> memory #location of the object.

@task.inspect would be more useful, or actually displaying some
specific attributes of the object :-)

> error log:
>
>  ActionController::ActionControllerError in TasksController#show
> Cannot redirect to nil!

But here, you're not even using your "random" method, you're calling
"show" -- check your routes.

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




[Rails] require current_password to update user information

2012-09-17 Thread dasibre
Rails newbie here, I have been stuck on this for two days and can't figure 
out why its not working.
I want users to confirm/verify themselves by entering their current/old 
password before any information is updated.
This is what My user_controller update action looks like
I'm currently using rails 3.2 with the basic has_secured_password 
authentication that comes with it.

 def update
@user = User.find(params[:id])
respond_to do |format|
if @user.update_attributes(params[:user])
format.html { redirect_to users_url, notice: "User #{@user.name} 
was successfully updated." }
format.json { head :no_content }
 else
format.html { render action: "edit" }
format.json { render json: @user.errors, status: 
:unprocessable_entity }
  end
end
  end

here's my form view


<% if params[:action] == "edit" %>

<%= f.label :password %>
<%= f.password_field :current_password, :placeholder => 
"current password" %>

<% end %>
  
<%= f.label :password, "Password" %>
<%= f.password_field :password, size: 40 %>
  
   
<%= f.label :password_confirmation, 'Confirm' %>
<%= f.password_field :password_confirmation, size: 40 %>
   

*I've tried using a before_update :confirm_password in the User model, but 
it hasn't worked.*
*I created a private method in the user controller*
*
*

private
def password_match
 @user = User.find(params[:id])
@user.authenticate(params[:current_password)
end
then call a before_filter :password_match, :only => [:update] in the user 
controller.

Can anyone help, please. Thank you.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/XdP_MLM92u0J.
For more options, visit https://groups.google.com/groups/opt_out.




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

2012-09-17 Thread Bogdan M.
(I'm having some hard time for days to manage to chose a random item
from teh database and to be able to pass it further.)

It is basic operation and i tried several ways all,  brought me to the
same problem,  params {"id" = "random"} <- the name of the controller
method

controller:

def random   # method works  checked it in the console. Returns a valid
obj.
  @task = Task.find(rand(Task.first.id..Task.last.id))
  render "random"
end

random.html.erb
   <%= @task %>   # i want it to make it work, if i pass manually
lets #say `../random/1` lets say as an example it works it shows me the
memory #location of the object.

error log:

 ActionController::ActionControllerError in TasksController#show
Cannot redirect to nil!

Rails.root: /home/bogdan/ex/bored
Application Trace | Framework Trace | Full Trace

actionpack (3.2.3) lib/action_controller/metal/redirecting.rb:60:in
`redirect_to'
actionpack (3.2.3) lib/action_controller/metal/flash.rb:25:in
`redirect_to'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:60:in
`block in redirect_to'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block
in instrument'
activesupport (3.2.3)
lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in
`instrument'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:59:in
`redirect_to'
actionpack (3.2.3) lib/action_controller/metal/implicit_render.rb:4:in
`send_action'
actionpack (3.2.3) lib/abstract_controller/base.rb:167:in
`process_action'
.
.
.
(only the top of the stack)

Request

Parameters:

{"id"=>"random"}

-- 
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 email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Biometrics fingerprint scanner in RoR? Is it possible? and how?

2012-09-17 Thread Walter Lee Davis

On Sep 17, 2012, at 12:14 PM, Scott Ribe wrote:

> On Sep 16, 2012, at 8:45 PM, RoR newbie wrote:
> 
>> I'm a graduating student of IT right now and in a couple of months, we'll be 
>> starting on a new project in the University. My group and I decided to 
>> create a voting system which requires Fingerprint scanner to identify the 
>> voters and make the voting process more secured. I still don't know how 
>> biometrics fingerprint scanner works exactly and I've just started to do 
>> some research.
>> 
>> So my question is, is it even possible that RoR can use a biometrics 
>> fingerprint scanner? 
>> 
>> I've been searching the net (until now) if there are some tutorials or tips 
>> that could help me do this project using RoR..
> 
> This is not a rails question at all. It's a web browser & fingerprint scanner 
> question.
> 
> Is there any way to access fingerprint scanner results from a web browser? If 
> so, using RoR to handle the backend of the web application is no different 
> than any other web app. If not, rails certainly can't help you around that 
> roadblock.

A lot of these external hardware devices talk to the host computer over USB, 
and some I have used (barcode scanners) basically pretend to be a keyboard 
typing really fast. I have no idea how your fingerprint reader is meant to 
interact with the host computer, but I would start by reading its manual and 
figuring out how it was meant to connect to a stand-alone PC. Then see how you 
can go from there. You could have a button to "start" the scanner, which would 
use JavaScript to shift focus to a hidden text field and wait for the scanner 
to "type" the results into that field. Poll the field for changes, and after a 
change and a pause (to avoid catching it half-way through a change) send the 
form to your Rails server. The rest, as others have said here, is as easy as 
Rails.

Walter

> 
> -- 
> Scott Ribe
> scott_r...@elevated-dev.com
> http://www.elevated-dev.com/
> (303) 722-0567 voice
> 
> 
> 
> 
> -- 
> 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 more options, visit https://groups.google.com/groups/opt_out.
> 
> 

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Biometrics fingerprint scanner in RoR? Is it possible? and how?

2012-09-17 Thread Scott Ribe
On Sep 16, 2012, at 8:45 PM, RoR newbie wrote:

> I'm a graduating student of IT right now and in a couple of months, we'll be 
> starting on a new project in the University. My group and I decided to create 
> a voting system which requires Fingerprint scanner to identify the voters and 
> make the voting process more secured. I still don't know how biometrics 
> fingerprint scanner works exactly and I've just started to do some research.
> 
> So my question is, is it even possible that RoR can use a biometrics 
> fingerprint scanner? 
> 
> I've been searching the net (until now) if there are some tutorials or tips 
> that could help me do this project using RoR..

This is not a rails question at all. It's a web browser & fingerprint scanner 
question.

Is there any way to access fingerprint scanner results from a web browser? If 
so, using RoR to handle the backend of the web application is no different than 
any other web app. If not, rails certainly can't help you around that roadblock.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




-- 
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 more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Simpleton routes

2012-09-17 Thread Joshua Niehus
Indeed, you are right! I saw what I was doing wrong. 

Thank you, 
Josh
"In your wisdom, I am humbled"

On Sunday, September 16, 2012 10:26:02 PM UTC-7, Hassan Schroeder wrote:
>
> Actually, your app goes to some blank page. The guide I linked to 
> earlier explains how to control that :-) 
>
> If that's not enough, post your request code and the corresponding 
> method from your controller. 
>
> -- 
> Hassan Schroeder  hassan.s...@gmail.com 
> http://about.me/hassanschroeder 
> twitter: @hassan 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/cIVJiOpeyTEJ.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Connecting to an external DB

2012-09-17 Thread Eastside Developer
I am trying to connect to an external database from my Rails
application. In my datanase.yml file, I have the following:

external_db:
  adapter:  mysql2
  database: external_src
  username: external_src
  password: mypassword
  host: myblog.com

The database is going to called to retrieve data for display in one of
the pages. I do have a pages controller, but I do not have a pages
model, so I created a pages mode, pages.rb and added the following to
it:

class Blog < ActiveRecord::Base
  establish_connection(:external_db)
  set_table_name :posts
end


Now, in my pages controller, how do I retrieve data? Let's say I have a
table in that database called pots and I would like to retrieve the post
with the id 2? I tried: Blog.find(2), but I am getting the following
error message: uninitialized constant PagesController::Blog

Any ideas?

-- 
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 email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Duplicate queries while eager loading multiple associations

2012-09-17 Thread Dennis Krupenik
thanks a lot, that did it

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/dITnC-NFoywJ.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] confusion about a exercise

2012-09-17 Thread Jonathan Maddison
Well, if you're trying not to look at the answer - the first test is meant
to look at the "title" that is actually displayed on the page (i.e.
heading), and the second test is supposed to check the actual HTML page
title (i.e.  tag).

On Mon, Sep 17, 2012 at 9:11 PM, roelof  wrote:

> Yes, I can.
> The exercise can be found here :
> http://ruby.railstutorial.org/chapters/static-pages#sec-static_pages_exercises
>
> Roelof
>
> Op maandag 17 september 2012 10:07:48 UTC+2 schreef Dihital het volgende:
>>
>> Indeed this is confusing. Can you provide an URL for the exercise?
>>
>> 2012/9/17 roelof 
>>
>>> Hello,
>>>
>>> I try to learn myself Ror by following this tutorial :
>>>
>>> Now I have to make this exercise :
>>>
>>> Make a Contact page for the sample app. First write a test for the
>>> existence of a page at the URI /static_pages/contact. (Hint: Test for the
>>> right title.) Then write a second test for the title “Ruby on Rails
>>> Tutorial Sample App | Contact”. Get your tests to pass, and then fill in
>>> the Contact page with the content from Listing 3.29.
>>>
>>> I wonder if I have to do the same twice. Both say I have to check on the
>>> title.
>>>
>>> Roelof
>>>
>>>  --
>>> 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 rubyonra...@googlegroups.**com.
>>> To unsubscribe from this group, send email to rubyonrails-ta...@**
>>> googlegroups.com.
>>>
>>> To view this discussion on the web visit https://groups.google.com/d/**
>>> msg/rubyonrails-talk/-/v-**0uIyfGUMEJ
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/UHgWsVy7rf8J.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] confusion about a exercise

2012-09-17 Thread Gintautas Šimkus
OK I am lost in this particular workflow. You should just test for title
and that's it. I don't see how 2 specs are needed for that. Sorry I
couldn't help.

2012/9/17 roelof 

> Yes, I can.
> The exercise can be found here :
> http://ruby.railstutorial.org/chapters/static-pages#sec-static_pages_exercises
>
> Roelof
>
> Op maandag 17 september 2012 10:07:48 UTC+2 schreef Dihital het volgende:
>>
>> Indeed this is confusing. Can you provide an URL for the exercise?
>>
>> 2012/9/17 roelof 
>>
>>> Hello,
>>>
>>> I try to learn myself Ror by following this tutorial :
>>>
>>> Now I have to make this exercise :
>>>
>>> Make a Contact page for the sample app. First write a test for the
>>> existence of a page at the URI /static_pages/contact. (Hint: Test for the
>>> right title.) Then write a second test for the title “Ruby on Rails
>>> Tutorial Sample App | Contact”. Get your tests to pass, and then fill in
>>> the Contact page with the content from Listing 3.29.
>>>
>>> I wonder if I have to do the same twice. Both say I have to check on the
>>> title.
>>>
>>> Roelof
>>>
>>>  --
>>> 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 rubyonra...@googlegroups.**com.
>>> To unsubscribe from this group, send email to rubyonrails-ta...@**
>>> googlegroups.com.
>>>
>>> To view this discussion on the web visit https://groups.google.com/d/**
>>> msg/rubyonrails-talk/-/v-**0uIyfGUMEJ
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/UHgWsVy7rf8J.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] confusion about a exercise

2012-09-17 Thread roelof
Yes, I can.
The exercise can be found here : 
http://ruby.railstutorial.org/chapters/static-pages#sec-static_pages_exercises

Roelof

Op maandag 17 september 2012 10:07:48 UTC+2 schreef Dihital het volgende:
>
> Indeed this is confusing. Can you provide an URL for the exercise? 
>
> 2012/9/17 roelof >
>
>> Hello, 
>>
>> I try to learn myself Ror by following this tutorial : 
>>
>> Now I have to make this exercise : 
>>
>> Make a Contact page for the sample app. First write a test for the 
>> existence of a page at the URI /static_pages/contact. (Hint: Test for the 
>> right title.) Then write a second test for the title “Ruby on Rails 
>> Tutorial Sample App | Contact”. Get your tests to pass, and then fill in 
>> the Contact page with the content from Listing 3.29.
>>
>> I wonder if I have to do the same twice. Both say I have to check on the 
>> title. 
>>
>> Roelof
>>
>>  -- 
>> 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 
>> rubyonra...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> rubyonrails-ta...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/rubyonrails-talk/-/v-0uIyfGUMEJ.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>   
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/UHgWsVy7rf8J.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: New to Ruby

2012-09-17 Thread Samir
Hi, Thanks for the Link. I am working on Linux environment

On Monday, September 17, 2012 3:22:51 PM UTC+5:30, Wasif Hyder wrote:
>
> http://ureddit.com/class/40250/web-programming-with-ruby-on-rails -
> This is a good choice to supplement with the Ruby on Rails tutorial. 
> Once you get through these comfortably, you can move onto more 
> advanced topics, and books.
>
> Also, Try keeping a blog as a journal and keep track of your day to
> day development. There are few problems that you'd keep encountering
> over and over again. An example is of setting up the environment, and
> common debugging problems that keep recurring.
>
> In addition, Edxonline.org has a software as a service course that is
> coming up which you can take. But you would need to become stronger
> in the programming aspect.
>
> Which platform are you developing on ? Windows, Linux, Mac ?
>
> On Saturday, September 15, 2012 9:16:15 AM UTC+4, Samir wrote:
>>
>> Hi Friends. I am extremely new to Ruby. can you please suggest me how to 
>> proceed to grab this in a short span of time...
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/3Sn73mlQF50J.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: New to Ruby

2012-09-17 Thread Wasif Hyder
http://ureddit.com/class/40250/web-programming-with-ruby-on-rails -
This is a good choice to supplement with the Ruby on Rails tutorial. 
Once you get through these comfortably, you can move onto more 
advanced topics, and books.

Also, Try keeping a blog as a journal and keep track of your day to
day development. There are few problems that you'd keep encountering
over and over again. An example is of setting up the environment, and
common debugging problems that keep recurring.

In addition, Edxonline.org has a software as a service course that is
coming up which you can take. But you would need to become stronger
in the programming aspect.

Which platform are you developing on ? Windows, Linux, Mac ?

On Saturday, September 15, 2012 9:16:15 AM UTC+4, Samir wrote:
>
> Hi Friends. I am extremely new to Ruby. can you please suggest me how to 
> proceed to grab this in a short span of time...
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/OUJO5TfgFfIJ.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Lottery Number Matching

2012-09-17 Thread Samir
Personal Exercise

On Friday, September 14, 2012 7:00:40 PM UTC+5:30, Samir wrote:
>
> Can any body please help me to solve this?
>
> Create a lottery app which will take a number as parameter and there will 
> be a set of number from 0 to n random number every time. 
> If the given number matches the random array[0] number by the program, 
> show a message you won the loterry.
> If the given number matches the random array[1] number by the program, 
> show a message you are second.
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/Ru8mpF9h2iIJ.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Re: Lottery Number Matching

2012-09-17 Thread Jim Ruther Nill
On Mon, Sep 17, 2012 at 7:28 PM, Samir wrote:

> Hi Jim. Thanks for the Suggestions. I will definitely work on it..But as i
> am new to Ruby m a bit worried how to catch the track and jump for
> development.
>

Is this something that the university gave you as a personal exercise?  Or
is this from some site tutorial you're following.  Either way, you should
start at the basics of ruby if you're really new to the language.


>
> On Monday, September 17, 2012 2:43:47 PM UTC+5:30, jim wrote:
>>
>>
>>
>> On Mon, Sep 17, 2012 at 7:02 PM, Samir wrote:
>>
>>> Here I have tried a bit.
>>>
>>>
>>> class Constlottery
>>> def self.rand_number
>>> randoms = []
>>> loop do
>>> puts "Enter a random number"
>>> new_number = gets.chomp
>>> if new_number.to_s == rand(1..9).to_s
>>> puts "You are winner"
>>> return
>>> else
>>> puts "You lost the chance"
>>> end
>>> end
>>> end
>>> end
>>>
>>> a = Constlottery.rand_number
>>>
>>> puts a
>>
>>
>> Hi Samir,
>>
>> Please consider the following
>>
>>- this groups isn't something that you can expect to work on your
>>university assignments
>>- we expect you to try and accomplish something by yourself, or
>>search through google, or read some tutorials first before posting here
>>- this post is already 3 days old so you should've made more progress
>>than what you have right now
>>- hearing "I've tried a bit" gives the notion that you haven't tried
>>at all
>>- try to analyze what each line of code does and i'm sure you'll get
>>it
>>- get back to this group if you're really stuck. give us insights on
>>what you've done to debug the problem and maybe, there'll be someone here
>>in the groups to help you
>>
>> Good luck!
>>
>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Friday, September 14, 2012 7:00:40 PM UTC+5:30, Samir wrote:
>>>
 Can any body please help me to solve this?

 Create a lottery app which will take a number as parameter and there
 will be a set of number from 0 to n random number every time.
 If the given number matches the random array[0] number by the program,
 show a message you won the loterry.
 If the given number matches the random array[1] number by the program,
 show a message you are second.

  --
>>> 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 rubyonra...@googlegroups.**com.
>>> To unsubscribe from this group, send email to rubyonrails-ta...@**
>>> googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/**
>>> msg/rubyonrails-talk/-/**5G5asAK5TDsJ
>>> .
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>
>>
>> --
>> --**--**-
>> visit my blog at http://jimlabs.heroku.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 email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/U09VrTzVlu8J.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
-
visit my blog at http://jimlabs.heroku.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 email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Re: Lottery Number Matching

2012-09-17 Thread Samir
Hi Jim. Thanks for the Suggestions. I will definitely work on it..But as i 
am new to Ruby m a bit worried how to catch the track and jump for 
development.

On Monday, September 17, 2012 2:43:47 PM UTC+5:30, jim wrote:
>
>
>
> On Mon, Sep 17, 2012 at 7:02 PM, Samir 
> > wrote:
>
>> Here I have tried a bit.
>>
>>
>> class Constlottery
>> def self.rand_number
>> randoms = []
>> loop do
>> puts "Enter a random number"
>> new_number = gets.chomp
>> if new_number.to_s == rand(1..9).to_s
>> puts "You are winner"
>> return
>> else
>> puts "You lost the chance"  
>> end
>> end
>> end
>> end
>>
>> a = Constlottery.rand_number
>>
>> puts a
>
>
> Hi Samir,
>
> Please consider the following
>
>- this groups isn't something that you can expect to work on your 
>university assignments 
>- we expect you to try and accomplish something by yourself, or search 
>through google, or read some tutorials first before posting here
>- this post is already 3 days old so you should've made more progress 
>than what you have right now 
>- hearing "I've tried a bit" gives the notion that you haven't tried 
>at all
>- try to analyze what each line of code does and i'm sure you'll get it
>- get back to this group if you're really stuck. give us insights on 
>what you've done to debug the problem and maybe, there'll be someone here 
>in the groups to help you 
>
> Good luck!
>  
>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Friday, September 14, 2012 7:00:40 PM UTC+5:30, Samir wrote:
>>
>>> Can any body please help me to solve this?
>>>
>>> Create a lottery app which will take a number as parameter and there 
>>> will be a set of number from 0 to n random number every time. 
>>> If the given number matches the random array[0] number by the program, 
>>> show a message you won the loterry.
>>> If the given number matches the random array[1] number by the program, 
>>> show a message you are second.
>>>
>>>  -- 
>> 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 
>> rubyonra...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> rubyonrails-ta...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/rubyonrails-talk/-/5G5asAK5TDsJ.
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> -
> visit my blog at http://jimlabs.heroku.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 email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/U09VrTzVlu8J.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Re: Lottery Number Matching

2012-09-17 Thread Jim Ruther Nill
On Mon, Sep 17, 2012 at 7:02 PM, Samir wrote:

> Here I have tried a bit.
>
>
> class Constlottery
> def self.rand_number
> randoms = []
> loop do
> puts "Enter a random number"
> new_number = gets.chomp
> if new_number.to_s == rand(1..9).to_s
> puts "You are winner"
> return
> else
> puts "You lost the chance"
> end
> end
> end
> end
>
> a = Constlottery.rand_number
>
> puts a


Hi Samir,

Please consider the following

   - this groups isn't something that you can expect to work on your
   university assignments
   - we expect you to try and accomplish something by yourself, or search
   through google, or read some tutorials first before posting here
   - this post is already 3 days old so you should've made more progress
   than what you have right now
   - hearing "I've tried a bit" gives the notion that you haven't tried at
   all
   - try to analyze what each line of code does and i'm sure you'll get it
   - get back to this group if you're really stuck. give us insights on
   what you've done to debug the problem and maybe, there'll be someone here
   in the groups to help you

Good luck!


>
>
>
>
>
>
>
>
>
>
>
>
> On Friday, September 14, 2012 7:00:40 PM UTC+5:30, Samir wrote:
>
>> Can any body please help me to solve this?
>>
>> Create a lottery app which will take a number as parameter and there will
>> be a set of number from 0 to n random number every time.
>> If the given number matches the random array[0] number by the program,
>> show a message you won the loterry.
>> If the given number matches the random array[1] number by the program,
>> show a message you are second.
>>
>>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/5G5asAK5TDsJ.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
-
visit my blog at http://jimlabs.heroku.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 email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Lottery Number Matching

2012-09-17 Thread Samir
Here I have tried a bit.


class Constlottery
def self.rand_number
randoms = []
loop do
puts "Enter a random number"
new_number = gets.chomp
if new_number.to_s == rand(1..9).to_s
puts "You are winner"
return
else
puts "You lost the chance"  
end
end
end
end

a = Constlottery.rand_number

puts a











On Friday, September 14, 2012 7:00:40 PM UTC+5:30, Samir wrote:
>
> Can any body please help me to solve this?
>
> Create a lottery app which will take a number as parameter and there will 
> be a set of number from 0 to n random number every time. 
> If the given number matches the random array[0] number by the program, 
> show a message you won the loterry.
> If the given number matches the random array[1] number by the program, 
> show a message you are second.
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/5G5asAK5TDsJ.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Lottery Number Matching

2012-09-17 Thread Samir
BPUT

On Friday, September 14, 2012 7:00:40 PM UTC+5:30, Samir wrote:
>
> Can any body please help me to solve this?
>
> Create a lottery app which will take a number as parameter and there will 
> be a set of number from 0 to n random number every time. 
> If the given number matches the random array[0] number by the program, 
> show a message you won the loterry.
> If the given number matches the random array[1] number by the program, 
> show a message you are second.
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/TwujY3qIKJgJ.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: New to Ruby

2012-09-17 Thread Samir
Thanks Friends. All the above links are really very helpful. :)

On Saturday, September 15, 2012 10:46:15 AM UTC+5:30, Samir wrote:
>
> Hi Friends. I am extremely new to Ruby. can you please suggest me how to 
> proceed to grab this in a short span of time...
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/_SM3ehO-QeUJ.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] (JOB) Looking for RoR Engineer

2012-09-17 Thread Gintautas Šimkus
Panayotis Matsinopoulos, I think we agree on the issue of getting enough
basic info from the initial ad text. I felt my thoughts about Greece was
correct in general, but loosely (and harshly) phrased. So I take the
"bankrupt" word back; though that's how I'd feel about this particular
country of work (again risking to have my numbers off, but 100+ billion in
financial help for 10 mln people are a lot in my book, as compared to my
country of 3 mln country in which such numbers don't even come up) even
when talking about the whole budget.

2012/9/17 Agis A. 

> Really? From all the countries in the world you wouldn't relocate to
> Greece to begin with?
>
>
> On Friday, 14 September 2012 13:22:13 UTC+3, Peter Hickman wrote:
>>
>> And this is why people complain about job ad on this list!
>>
>> No location (I will not relocate to Greece for this job)
>> No salary (Without the location I have no idea as to the cost of
>> living and cannot judge the value of the package)
>> No company details (I have no interest in working for another "me too"
>> groupon clone)
>>
>> Without these details people who are unsuitable for the post will
>> apply and waste your time and people who are suitable will ignore it
>> because it is clearly a fishing expedition - you do not really have a
>> post available you just want a bunch of CVs to pester people with.
>>
>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/KSYq4k87YdEJ.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] confusion about a exercise

2012-09-17 Thread Gintautas Šimkus
Indeed this is confusing. Can you provide an URL for the exercise?

2012/9/17 roelof 

> Hello,
>
> I try to learn myself Ror by following this tutorial :
>
> Now I have to make this exercise :
>
> Make a Contact page for the sample app. First write a test for the
> existence of a page at the URI /static_pages/contact. (Hint: Test for the
> right title.) Then write a second test for the title “Ruby on Rails
> Tutorial Sample App | Contact”. Get your tests to pass, and then fill in
> the Contact page with the content from Listing 3.29.
>
> I wonder if I have to do the same twice. Both say I have to check on the
> title.
>
> Roelof
>
>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/v-0uIyfGUMEJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Biometrics fingerprint scanner in RoR? Is it possible? and how?

2012-09-17 Thread Gintautas Šimkus
Firstly, it doesn't seem right to make a decision while you are still
unsure if that is doable by the deadline. In theory I don't see why it
couldn't be possible, just it could require a lot of work. But isn't it the
point for your group of educated people to come up with something in such a
project thus enriching the knowledge available for RoR community?

P.S. I gather from your post that this is a non-commercial project designed
to prove your expertise in the field.

2012/9/17 Jim Ruther Nill 

> Hi!
>
> On Mon, Sep 17, 2012 at 12:45 PM, RoR newbie wrote:
>
>> I'm a graduating student of IT right now and in a couple of months, we'll
>> be starting on a new project in the University. My group and I decided to
>> create a voting system which requires Fingerprint scanner to identify the
>> voters and make the voting process more secured. I still don't know how
>> biometrics fingerprint scanner works exactly and I've just started to do
>> some research.
>>
>> So my question is, is it even possible that RoR can use a biometrics
>> fingerprint scanner?
>>
>
> I'm pretty sure that the biometrics fingerprint scanner should be able to
> output something if a user is a registered voter or not.  You just have
> to hook this something into the database to check who the current voter
> is.  So overall, the question is not really if you can do this with rails,
> it's if the fingerprint scanner gives you flexibility to do this.
>
> I've been searching the net (until now) if there are some tutorials or
>> tips that could help me do this project using RoR..
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/rubyonrails-talk/-/ufjilClikwQJ.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> -
> visit my blog at http://jimlabs.heroku.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 email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 more options, visit https://groups.google.com/groups/opt_out.




[Rails] confusion about a exercise

2012-09-17 Thread roelof
Hello, 

I try to learn myself Ror by following this tutorial : 

Now I have to make this exercise : 

Make a Contact page for the sample app. First write a test for the 
existence of a page at the URI /static_pages/contact. (Hint: Test for the 
right title.) Then write a second test for the title “Ruby on Rails 
Tutorial Sample App | Contact”. Get your tests to pass, and then fill in 
the Contact page with the content from Listing 3.29.

I wonder if I have to do the same twice. Both say I have to check on the 
title. 

Roelof

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/v-0uIyfGUMEJ.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Biometrics fingerprint scanner in RoR? Is it possible? and how?

2012-09-17 Thread Jim Ruther Nill
Hi!

On Mon, Sep 17, 2012 at 12:45 PM, RoR newbie  wrote:

> I'm a graduating student of IT right now and in a couple of months, we'll
> be starting on a new project in the University. My group and I decided to
> create a voting system which requires Fingerprint scanner to identify the
> voters and make the voting process more secured. I still don't know how
> biometrics fingerprint scanner works exactly and I've just started to do
> some research.
>
> So my question is, is it even possible that RoR can use a biometrics
> fingerprint scanner?
>

I'm pretty sure that the biometrics fingerprint scanner should be able to
output something if a user is a registered voter or not.  You just have
to hook this something into the database to check who the current voter is.
 So overall, the question is not really if you can do this with rails, it's
if the fingerprint scanner gives you flexibility to do this.

I've been searching the net (until now) if there are some tutorials or tips
> that could help me do this project using RoR..
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/ufjilClikwQJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
-
visit my blog at http://jimlabs.heroku.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 email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Duplicate queries while eager loading multiple associations

2012-09-17 Thread Frederick Cheung


On Monday, September 17, 2012 2:45:05 AM UTC+1, Dennis Krupenik wrote:
>
> Hello all,
>
> given the following models and console log: 
> https://gist.github.com/3735116
>
> I do not understand why the latter statements (o.order_items and o.total) 
> yield sql queries.
> Have I missed something in AR documentation? What should be done to get 
> rid of redundant sql queries?
>
> oi = o.order_items.includes(item: :photos) 

does not mutate o.order_items, adding the includes to it: it returns a new 
array of objects that has the extra options applied. 

You do o = Order.includes(order_items: {item: photos}).last in which case

o.order_items should  not execute any queries

Fred

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/MFvhLesbj-kJ.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Duplicate queries while eager loading multiple associations

2012-09-17 Thread Dennis Krupenik
Hello all,

given the following models and console log: https://gist.github.com/3735116

I do not understand why the latter statements (o.order_items and o.total) 
yield sql queries.
Have I missed something in AR documentation? What should be done to get rid 
of redundant sql queries?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/tMZF4jbjC7oJ.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Biometrics fingerprint scanner in RoR? Is it possible? and how?

2012-09-17 Thread RoR newbie
I'm a graduating student of IT right now and in a couple of months, we'll 
be starting on a new project in the University. My group and I decided to 
create a voting system which requires Fingerprint scanner to identify the 
voters and make the voting process more secured. I still don't know how 
biometrics fingerprint scanner works exactly and I've just started to do 
some research.

So my question is, is it even possible that RoR can use a biometrics 
fingerprint scanner? 

I've been searching the net (until now) if there are some tutorials or tips 
that could help me do this project using RoR..

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/ufjilClikwQJ.
For more options, visit https://groups.google.com/groups/opt_out.