[Rails] Advanced ActiveRecord tutorials

2014-02-24 Thread Ganesh Ranganathan
Any recommendations for good advanced tutorials on ActiveRecord in Rails4?

I'm interested in joins, group, counts especially for deep associations.

Thanks,
Ganesh

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CALFmRoHX7XPVkkXjots8hD68VUZbF4MM6P1oDNJutiym1mUoPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Rails] Refresh token using Omniauth-oauth2 in Rails application?

2014-02-24 Thread Ganesh Ranganathan
On Fri, Feb 14, 2014 at 9:03 PM, Jordon Bedwell envyge...@gmail.com wrote:

 Last I remember omniauth does not support this at all.  No, a helper
 is not the best place to do it, you should probably either background
 check the token and refresh it there or add it as a method to the user
 model since it's related to the user and it's behavior


Thanks,

I added it to the User model which makes a rest-client call and gets the
new refreshed code.

Here is the code
http://stackoverflow.com/questions/21707734/refresh-token-using-omniauth-oauth2-in-rails-application

Cheers,
Ganesh


-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CALFmRoGNK4j0%3DGfR%3DJbxZaGGdc%3D_aK5UDgvGQHbjHABX1jqDtw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] harmony gem issue

2014-02-24 Thread saravanan p
Hello everyone,

saravanan@ubuntu:~$ ruby -v
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]
saravanan@ubuntu:~$ rails -v
Rails 4.0.3
saravanan@ubuntu:~$ rvm -v

rvm 1.24.4 (stable) by Wayne E. Seguin wayneeseg...@gmail.com, Michal 
Papis mpa...@gmail.com [https://rvm.io/]

*I am trying to install harmony gem for data scraping.*

saravanan@ubuntu:~$ gem install harmony
Building native extensions.  This could take a while...
ERROR:  Error installing harmony:
ERROR: Failed to build gem native extension.

/home/saravanan/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
creating cache ./config.cache
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking build system type... x86_64-unknown-linux-gnu
checking for mawk... mawk
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for c++... c++
checking whether the C++ compiler (c++  ) works... yes
checking whether the C++ compiler (c++  ) is a cross-compiler... no
checking whether we are using GNU C++... yes
checking whether c++ accepts -g... yes
checking for ranlib... ranlib
checking for as... /usr/bin/as
checking for ar... ar
checking for ld... ld
checking for strip... strip
checking for windres... no
checking whether gcc and cc understand -c and -o together... yes
checking how to run the C preprocessor... gcc -E
checking how to run the C++ preprocessor... c++ -E
checking for a BSD compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for perl5... no
checking for perl... /usr/bin/perl
checking for minimum required perl version = 5.006... 5.014002
checking for full perl installation... yes
checking for python... /usr/bin/python
checking for doxygen... :
checking for whoami... /usr/bin/whoami
checking for autoconf... /usr/bin/autoconf
checking for unzip... /usr/bin/unzip
checking for zip... /usr/bin/zip
checking for makedepend... no
checking for xargs... /usr/bin/xargs
checking for gmake... no
checking for make... /usr/bin/make
checking for X... libraries , headers 
checking for dnet_ntoa in -ldnet... no
checking for dnet_ntoa in -ldnet_stub... no
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking whether the compiler supports -Wno-invalid-offsetof... yes
checking whether the compiler supports -Wno-variadic-macros... yes
checking whether ld has archive extraction flags... yes
checking that static assertion macros used in autoconf tests work... yes
checking for 64-bit OS... yes
checking for ANSI C header files... yes
checking for working const... yes
checking for mode_t... yes
checking for off_t... yes
checking for pid_t... yes
checking for size_t... yes
checking for st_blksize in struct stat... yes
checking for siginfo_t... yes
checking for stdint.h... yes
checking for the size of void*... 8
checking for the alignment of void*... 8
checking for the size of double... 8
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for int64... no
checking for uint... yes
checking for uint_t... no
checking for uint16_t... no
checking for uname.domainname... yes
checking for uname.__domainname... no
checking for visibility(hidden) attribute... yes
checking for visibility(default) attribute... yes
checking for visibility pragma support... yes
checking For gcc visibility bug with class-level attributes (GCC bug 
26905)... no
checking For x86_64 gcc visibility bug with builtins (GCC bug 20297)... no
checking for dirent.h that defines DIR... yes
checking for opendir in -ldir... no
checking for sys/byteorder.h... no
checking for compat.h... no
checking for getopt.h... yes
checking for sys/bitypes.h... yes
checking for memory.h... yes
checking for unistd.h... yes
checking for gnu/libc-version.h... yes
checking for nl_types.h... yes
checking for malloc.h... yes
checking for X11/XKBlib.h... yes
checking for sys/statvfs.h... yes
checking for sys/statfs.h... yes
checking for sys/vfs.h... yes
checking for sys/mount.h... yes
checking for mmintrin.h... yes
checking for new... yes
checking for sys/cdefs.h... yes
checking for gethostbyname_r in -lc_r... no
checking for atan in -lm... yes
checking for dlopen in -ldl... yes
checking for dlfcn.h... yes
checking for dladdr... yes
checking for socket in -lsocket... no
checking for pthread_create in -lpthreads... no
checking for pthread_create in -lpthread... yes
checking whether gcc accepts -pthread... yes
checking whether mmap() sees write()s... yes
checking whether gcc needs -traditional... no
checking for 8-bit clean memcmp... yes
checking for fchmod... yes
checking for flockfile... yes
checking for getc_unlocked... yes
checking for _getc_nolock... no
checking for getpagesize... yes
checking for 

[Rails] Newbie friendly open source project?

2014-02-24 Thread lala
Hello,

I'm a hobby programmer learning Rails and I love it! I've done a few of my 
own RoR projects and now I would like to start participating in open source 
for the first time in my life. I am terrified of doing my first ever pull 
request. Could anyone please recommend an open source project that

* Has a friendly community
* Is not too big and intimidating a project (I'm not ready to start making 
pull requests to Rails itself for example)

Thank you for reading!

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/fb564ce8-b16c-415a-a305-416120aa2527%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Please help to DRY snippet

2014-02-24 Thread Роман Ярыгин
Hello. Please, help me to DRY this code snippet. The task is to print div 
content, but to print it in div, when i%17 ==0 and make it without div, 
when not. I guess that it maybe proc or lambda will help, but I never used 
it before. Or maybe it is some simpler method?

#splitter
  - @servers.each_with_index do |server, i|
   * - if i % 17 == 0*
*  = content_tag :div, class: pane-content do*
*= link_to #, class: list-group-item server, :data-id = 
server.id, :data-name = server.name, :data-address = server.address 
do*
*  %strong= server.name*
*  =, *
*  = server.address*
   * - else*
 * = link_to #, class: list-group-item server, :data-id = 
server.id, :data-name = server.name, :data-address = server.address 
do*
*%strong= server.name*
*=, *
*= server.address*


-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/514b32c0-0d18-4d9d-961d-6c94b08524c1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Full-stack Ruby on Rails Programmer for Swiss startup

2014-02-24 Thread David Leza
RECOMY is a Swiss startup aiming to change the job/recruiting market. We
are looking for a talented RoR developer who is willing to take the leap
and join us in developing something truly remarkable.

Your profile:

- You are highly motivated to join a startup with all the risks and
benefits this includes
- You are available to work full time
- Have various years of Ruby on Rails experience
- Experienced in following front-end technologies: Javascript,
CoffeeScript, Haml
- Experience in Backbone.js would be a plus
- Use test-driven development (ie: Jasmine, RSpec)
- MySQL
- Git
- Basic UNIX sysadmin skills

Your tasks:

- Handover project from external team
- Take the lead in further developing a modern and intelligent platform
- Take initiative, responsibility and display creativity when
implementing solutions

What we offer you:

- Be an integral part of an existing young Swiss startup
- Freedom to implement creative solutions
- Work remotely (but should be available to come into the office)
- Flexible work hours
- Depending on the success of the prototype, co-owner status (including
all responsibilities and benefits of being a co-founder).

Who we are:

- We are a highly motivated and diverse team with experience in sales,
marketing and finance
- Located in Colab Zurich (http://colab-zurich.ch/)
- We think we truly have a successful idea and want you to help us make
our stand in the job/recruiting market

Interested?
Apply below! We are looking forward to hearing from you. Send us your CV
and a sample of your work (eg. Github account) and tell us why you are
the perfect match!

Questions?
Don't hesitate to contact us:
David Leza
t...@recomy.com

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/584639e3ddf3bedb975628eee15539a6%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Rails] Please help to DRY snippet

2014-02-24 Thread Dave Aronson
On Mon, Feb 24, 2014 at 7:35 AM, Роман Ярыгин 330...@gmail.com wrote:

 Please, help me to DRY this code snippet. The task is to print div content,
 but to print it in div, when i%17 ==0 and make it without div, when not.

A view helper method would do the trick.  Make one that returns the
bit that stays the same (the link_to, strong, comma, and server
address), then call it where you have those things.

Or you could use a decorator that contains the logic of looking at i.

-Dave

-- 
Dave Aronson, the T. Rex of Codosaurus LLC (www.codosaur.us);
FREELANCE SOFTWARE DEVELOPER, AVAILABLE AS OF MARCH 1st 2014;
creator of Pull Request Roulette, at PullRequestRoulette.com.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAHxKQigHXzD%2BZ%2BH-0LCKkYS5-GwUiAv4xPadywhTucJkpo2F-A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Custom order of Hash

2014-02-24 Thread Artem Kalinchuk
Would a custom order of a hash be useful in Rails?

If I have the following Hash:

my_hash = { key1: 'value', key2: 'value', key3: 'value' }


And I want to order it by the following keys:

my_hash = my_hash.order(:key2, :key1, :key3)


I would get a new hash with the following result:

puts my_hash

= { key2: 'value', key1: 'value', key3: 'value' }


Using the following code:

class Hash
  def order(*keys)
Hash[keys.collect {|k| self[k] ? [k, self[k]] : nil }.compact]
  end
end


Any thoughts?

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/285cec00-c279-405b-982e-0710501bcb68%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Rails] Custom order of Hash

2014-02-24 Thread Gautam Rege
Having an OrderedHash that saves insertion order is useful enough and I 
personally don't see a reason for a custom ordered hash.
Wouldn't it be less expensive to order only the keys in a separate array and 
access the hash rather than creating a new hash?

My 2 cents.
--
@gautamrege
~~~
All wiyht. Rho sritched mg kegtops awound?

On 24-Feb-2014, at 8:58 pm, Artem Kalinchuk art...@gmail.com wrote:

 Would a custom order of a hash be useful in Rails?
 
 If I have the following Hash:
 
 my_hash = { key1: 'value', key2: 'value', key3: 'value' }
 
 And I want to order it by the following keys:
 
 my_hash = my_hash.order(:key2, :key1, :key3)
 
 I would get a new hash with the following result:
 
 puts my_hash
 = { key2: 'value', key1: 'value', key3: 'value' }
 
 Using the following code:
 
 class Hash
   def order(*keys)
 Hash[keys.collect {|k| self[k] ? [k, self[k]] : nil }.compact]
   end
 end
 
 Any thoughts?
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to rubyonrails-talk+unsubscr...@googlegroups.com.
 To post to this group, send email to rubyonrails-talk@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/rubyonrails-talk/285cec00-c279-405b-982e-0710501bcb68%40googlegroups.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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/AE2882EE-E9F3-45F2-B036-493DA2EC9E8A%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Rails] Custom order of Hash

2014-02-24 Thread Scott Ribe
On Feb 24, 2014, at 8:28 AM, Artem Kalinchuk art...@gmail.com wrote:

 Any thoughts?

Hashes are by definition unordered. If you think you need an ordered hash, then 
you probably don't understand hashes...

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CDBF61C5-E2BA-47B8-B7E1-B6893484090A%40elevated-dev.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Jim Weirich's final GitHub commit

2014-02-24 Thread Ganesh Ranganathan
https://github.com/jimweirich/wyriki/commit/d28fac7f18aeacb00d8ad3460a0a5a901617c2d4

Nice of Github to put up a banner in his honour.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CALFmRoESTd54RTFeXrYr4Mj0HVUqdUw57Jf73W7aSqxrOBZfhw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Rails] Custom order of Hash

2014-02-24 Thread Gautam Rege

 Hashes are by definition unordered. If you think you need an ordered hash, 
 then you probably don't understand hashes...

Ruby 1.9 onwards saves the insertion order of hashes. In fact in Ruby 2.1 - a 
hash of under 6 elements is stored as an array ;)

2.1.0 :001  hsh = {'a' = 1, 'b' = 2, 'c' = 3}
 = {a=1, b=2, c=3}

1.8.7-p374 :001  hsh = {'a' = 1, 'b' = 2, 'c' = 3}
 = {c=3, b=2, a=1} 

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/5C16C135-C276-4F4F-881D-DF166CF1644B%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Rails] Custom order of Hash

2014-02-24 Thread Artem Kalinchuk
There is a reason why we have ordered hashes...

On Monday, February 24, 2014 11:53:04 AM UTC-5, Scott Ribe wrote:

 On Feb 24, 2014, at 8:28 AM, Artem Kalinchuk art...@gmail.comjavascript: 
 wrote: 

  Any thoughts? 

 Hashes are by definition unordered. If you think you need an ordered hash, 
 then you probably don't understand hashes... 

 -- 
 Scott Ribe 
 scott...@elevated-dev.com javascript: 
 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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/baf4e34b-ee60-4696-822c-41b4c9e46b87%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Rails] Custom order of Hash

2014-02-24 Thread Artem Kalinchuk
Honestly, I've needed it many times and was surprised that it wasn't 
implemented yet. Of course, there are a few ways you can do this (probably 
more efficient way than what I suggested) but we also need to keep in mind 
that we should keep our code as DRY as possible.

On Monday, February 24, 2014 11:30:38 AM UTC-5, gautamrege wrote:

 Having an OrderedHash that saves insertion order is useful enough and I 
 personally don’t see a reason for a custom ordered hash.
 Wouldn’t it be less expensive to order only the keys in a separate array 
 and access the hash rather than creating a new hash?

 My 2 cents.
 --
 @gautamrege
 ~~~
 All wiyht. Rho sritched mg kegtops awound? 

 On 24-Feb-2014, at 8:58 pm, Artem Kalinchuk art...@gmail.comjavascript: 
 wrote:

 Would a custom order of a hash be useful in Rails?

 If I have the following Hash:

 my_hash = { key1: 'value', key2: 'value', key3: 'value' }


 And I want to order it by the following keys:

 my_hash = my_hash.order(:key2, :key1, :key3)


 I would get a new hash with the following result:

 puts my_hash

 = { key2: 'value', key1: 'value', key3: 'value' }


 Using the following code:

 class Hash
   def order(*keys)
 Hash[keys.collect {|k| self[k] ? [k, self[k]] : nil }.compact]
   end
 end


 Any thoughts?

 -- 
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to rubyonrails-ta...@googlegroups.com javascript:.
 To post to this group, send email to rubyonra...@googlegroups.comjavascript:
 .
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/rubyonrails-talk/285cec00-c279-405b-982e-0710501bcb68%40googlegroups.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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ba8034af-bab6-4f4a-8771-41f1365c6e09%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Rails] Re: Best IDEs for Ruby on Rails

2014-02-24 Thread Ricardo do Valle
Vim + a lot of configs and plugins:
https://github.com/skwp/dotfiles

Rubymine is very good to start, but it is heavy.



On Sun, Feb 23, 2014 at 11:18 PM, Filipe Chagas froccha...@gmail.comwrote:

 Tmux + Vim + Some plugins - It's better than any IDE.

 Em sexta-feira, 21 de fevereiro de 2014 13h24min52s UTC-3, Phil Dobbin
 escreveu:

 On 21/02/2014 11:17, Ganesh Ranganathan wrote:
 
  On Fri, Feb 21, 2014 at 4:43 PM, Dat Nguyen li...@ruby-forum.com
  mailto:li...@ruby-forum.com wrote:
 
  Sublime Text is impressive coding editor. I use it for PHP
 development.
  But for Ruby on Rails I don't think it is a good choice. Instead, I
 use
  RubyMine (of course, it's not free):
 
 
  I use tmux+vim and it as good as any IDE and more customizable.

 I also use Vim. I couldn't imagine using any other editor.

 Tim Pope has some great Ruby/Rails plugins for Vim on Github.

 Cheers,

   Phil...

 --
 currently (ab)using
 Arch Linux, CentOS 6.5, Debian Squeeze  Wheezy, Fedora 19  20, OS X
 Snow Leopard, RHEL 7, Ubuntu Saucy
 GnuGPG Key : http://phildobbin.org/publickey.asc


  --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to rubyonrails-talk+unsubscr...@googlegroups.com.
 To post to this group, send email to rubyonrails-talk@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/rubyonrails-talk/bac49a79-9ab7-4315-bf25-2da4c7f3f2a6%40googlegroups.com
 .

 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Ricardo do Valle

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CALQXn36hQq_8RSg4CarKtUYSCcyqSp%2BB22PY2jZEpTE%3Dso1pXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Optimize query to use sql over ruby iterators

2014-02-24 Thread John Merlino
I have the following setup:

class Unit
  has_many :reports
end

class Report
  belongs_to :unit
end

Basically I have a list of units and I want to select the last report for 
each unit (based on time) and order the resulting last reports by longitude.

Sounds simple, but my implementation looks like this:

units = current_user.accessible_units
report_ids = []
if units.size  0
  units.map(:id).uniq.each do |id|
report = Report.select(:id).where(unit_id: id).order(time 
desc).limit(1)
if !report.empty?
  report_ids  report.try(:first).try(:id)
end
  end
end
reports = Report.where(id: report_ids).order(longitude desc)

Is there a way to perform this same query using sql (active record 
relations) and minimize the use of ruby iterators, like map and each? Also 
notice in query above, I make two hits to the database by querying reports 
for time and then descending order. Is there a way to eliminate that too?

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/dcd64657-0231-4d6a-ad24-6eab7466a493%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: ExecJS::RuntimeError in Say#hello

2014-02-24 Thread jim
It looks like this may help http://stackoverflow.com/a/14118913

Jim

On Sunday, February 23, 2014 5:38:04 AM UTC-5, Askhat Bolatkhan wrote:

 Showing *D:/RailsInstaller/blog/app/views/layouts/application.html.erb* where 
 line *#6* raised:


 module.js:340
 throw err;
   ^
 Error: Cannot find module 
 'C:\Windows\system32\config\SYSTEM~1\AppData\Local\Temp\execjs20140223-5592-h2cx72.js'
 at Function.Module._resolveFilename (module.js:338:15)
 at Function.Module._load (module.js:280:25)
 at Function.Module.runMain (module.js:497:10)
 at startup (node.js:119:16)
 at node.js:902:3

   (in 
 D:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/turbolinks-2.2.1/lib/assets/javascripts/turbolinks.js.coffee)

 Extracted source (around line *#6*):

 3
 4
 5
 6
 7
 8
 9
   

   head
 titleBlog/title
 %= stylesheet_link_tagapplication, media: all, 
 data-turbolinks-track = true %
 %= javascript_include_tag application, data-turbolinks-track = true 
 %
 %= csrf_meta_tags %
   /head
   body

 Rails.root: D:/RailsInstaller/blog
 Application Trace http://localhost:3000/say/hello# | Framework 
 Tracehttp://localhost:3000/say/hello#
  | Full Trace http://localhost:3000/say/hello#

 app/views/layouts/application.html.erb:6:in 
 `_app_views_layouts_application_html_erb__73207673_32049480'

 Request

 *Parameters*:

 None

 Toggle session dump http://localhost:3000/say/hello#
 Toggle env dump http://localhost:3000/say/hello#
 Response

 *Headers*:

 None


 Please help to solve this problem!



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/05ed1414-986f-4c7e-8470-1623d38ab30c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: fails ruby-ldap on ubuntu 10.04

2014-02-24 Thread Keith Mascarenhas
Hi,

I had the same error. The ruby-ldap gem required a library called 
libldap2-dev to work.
Try sudo apt-get install libldap2-dev and then try installing the gem again.

On Friday, October 15, 2010 1:13:16 AM UTC-4, Ruby-Forum.com User wrote:

 Hi,
I tried to install ruby-ldap 0.9.9 on ubuntu 10.04 with ruby 1.8.7.
 but i get the error. can anyone help me out?

 Building native extensions.  This could take a while...
 ERROR:  Error installing ruby-ldap:
   ERROR: Failed to build gem native extension.

 /usr/bin/ruby1.8 extconf.rb
 --with-openldap2
 checking for ldap.h... no
 checking for lber.h... no
 checking for ldap_ssl.h... no
 *** 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
   --without-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=/usr/bin/ruby1.8
   --with-netscape
   --without-netscape
   --without-netscape
   --with-openldap1
   --without-openldap1
   --without-openldap1
   --with-openldap2
   --without-openldap2
   --without-openldap2
   --with-wldap32
   --without-wldap32
   --without-wldap32
   --with-ldap-dir
   --without-ldap-dir
   --with-ldap-include
   --without-ldap-include=${ldap-dir}/include
   --with-ldap-lib
   --without-ldap-lib=${ldap-dir}/lib
   --with-ldap-dir
   --without-ldap-dir
   --without-ldap-dir
   --with-ldap
   --without-ldap
   --without-ldap
   --with-libresolv
   --without-libresolv
   --without-libresolv
   --with-libcrypto
   --without-libcrypto
   --without-libcrypto
   --with-libssl
   --without-libssl
   --without-libssl
   --with-libpthread
   --without-libpthread
   --without-libpthread
   --with-libnsl
   --without-libnsl
   --without-libnsl
   --with-liblber
   --without-liblber
   --without-liblber
   --with-libldap_r
   --without-libldap_r
   --without-libldap_r
   --with-libldap
   --without-libldap
   --without-libldap
 can't find ldap.h and lber.h
 use the option '--with-ldap-dir'!


 Gem files will remain installed in
 /usr/lib/ruby/gems/1.8/gems/ruby-ldap-0.9.9 for inspection.
 Results logged to
 /usr/lib/ruby/gems/1.8/gems/ruby-ldap-0.9.9/gem_make.out

 -- 
 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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/cde3c8ae-ed3b-49c3-98d6-2c0851651905%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] JOBS - Cambridge, MA Start Up seeks experienced Ruby Developer

2014-02-24 Thread Kathleen Gilroy
We are looking for an experience Ruby developer to work on our new location 
services platform.  This is a full time and/or project position depending 
upon your availability and interest.  We are rewriting our mobile event 
platform to support location services.  We have a contract to deploy the 
platform at over 50 million square feet of convention center space and we 
are expanding to campuses, stadiums, hotels and casinos and other large 
indoor spaces.  We are working closely with Cisco's top engineers to 
integrate the Cisco Mobility Services Engine into our platform.  This is a 
great gig; great team; great work location; flexible hours; great pay and 
benefits.  We are a group of start-up types and we are looking for creative 
innovative coders (and people who like to party).  If you are interested 
exploring this opportunity, please email me at kathl...@swiftmobile.com.  

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/10a0947d-1b8c-4fbf-8510-ba3e575ccdc2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Looking for RoR Partner for New StartupLeap project

2014-02-24 Thread Algirdas Matijosaitis


https://lh5.googleusercontent.com/-eaYmtnb6JoU/UwwhlaUvApI/Adw/jHxCTS0_UMU/s1600/sl+logo.png






About Project

StartupLeap is the network for you to prepare your Startups for 
Crowdfunding or Angel funding. Build hype and buzz around your Startup when 
you connect with other users and add them to your team either as 
temporaries or permanent members of your team. Let the entire network give 
you a hand shaping your Startup and building the trust to leap the way you 
wanted.

 

We are seeking for

RoR Developer

 

What we offer

Share of the project

 

Remember this project has not been funded yet and we are not looking for 
those who can get only the job done. So if you want to invest your time 
knowledge and skills with us and you are passionate on what you do. To 
build something amazing you can contact us to found out more about us and 
the project.

 

Email: algir...@corbgroup.com or skype: matijosaitisa

 

 

Regards

Algirdas Matijosaitis

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/bffd96cd-0495-4a9b-b5cb-45340575c853%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Best IDEs for Ruby on Rails

2014-02-24 Thread Yin Wang
That's true. I used RubyMine to develop the Ruby part in my project and it 
was much more helpful than editors and command line. I developed program 
analysis tools for languages, so I know how much more advanced are IDEs 
compared to text editors. They are qualitatively different. JetBrains does 
a great job.


On Tuesday, March 19, 2013 5:40:32 AM UTC-7, jle...@socit.co.uk wrote:

 RubyMine 5.0.2 Fabulous IDE, excellent value for money, superb debugging 
 with code coverage and VCS integration, stack analysis, object tree view, 
 model diagrams, db integration and lots more.

 I think the obsession with the command line just overwhelms you with 
 detail, a bit like looking at the hex generated by assembler.  Do not be 
 fooled by this obsessive elitism.

 Give it a try free, also the support is really quick.

 John

 On Saturday, 16 March 2013 04:40:37 UTC, Jason Hsu, Android developer 
 wrote:

 What are your favorite IDEs for Ruby on Rails?  Are there any good IDEs 
 that IMMEDIATELY flag problems the way Eclipse does in Android 
 development?  Given the importance of testing, I'd like to use a tool that 
 immediately and automatically flags problems.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/5973bd76-43d1-46ef-87d1-0f233655c6c6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Best Way To Manage Mutable Public Rails Return Types

2014-02-24 Thread Matt Glover
Our team ran into a problem in a Rails application today where someone 
unknowingly modified Rails internals leading to bad query generation. The 
developer modified the list of attribute names for a model by reading and 
then mutating the contents of 
attribute_nameshttp://api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/ClassMethods.html#method-i-attribute_nameson
 an 
ActiveRecord model class. For a variety of reasons it was not immediately 
obvious that they were modifying the results of this call so it took a 
while to track down.

Certain query generation code paths, such as distinct counts, can rely on 
private methods like 
aggregate_columnhttps://github.com/rails/rails/blob/c9346322b15c15f51234c33a3db1b3895ffe84ab/activerecord/lib/active_record/relation/calculations.rb#L220-L226that
 depend on an accurate list of column names to properly prefix column 
names with table names. Because attribute_names happens to expose the 
internal array used to track column names any modifications to the return 
value of attribute_names can break query generation.

For example (using the ActiveRecord master bug report demo models): 
https://gist.github.com/matt-glover/9202013

In our case developers did not intend to modify a core array utilized by 
Rails for query generation when they modified the results of the 
public-facing method. On the other hand I imagine there are cases where 
this level of mutability in Ruby and Rails is helpful to people writing 
plugins. My core question is how others recommend my team avoid this 
particular class of issue going forward.

A few possibilities immediately come to mind:

   1. Someone much smarter than me comes up with a better solution than 
   anything that follows
   2. Via thorough testing, static analysis, code review, and careful 
   attention try to avoid this class of issue going forward
  - Interested in any tools or other advice to aid this effort
   3. Find documentation that identifies the publicly visible Rails methods 
   intended to be part of the public API
  - Perhaps some documentation considers methods like attribute_names that 
  can trigger this type of issue to be excluded from the Rails API
  - Is there a clear line between publicly visible Rails methods and 
  intended parts of the API?
  4. Claim this behavior is a bug and submit a patch for it because 
   mutation of the resulting array has problematic implications and it 
   arguably breaks encapsulation
  - I do not plan to pursue this approach unless there is broad 
  agreement that the current behavior is incorrect as mutability is 
  commonplace in Ruby
  - For the sake of this post I am interested in this particular method 
  call but not interested in a theoretical discussion about mutability and 
  encapsulation in general
  - I am happy to have a separate theoretical discussion on those 
 broader topics via a channel that does not spam the entire mailing list
 

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ef276779-1ef7-47aa-9e98-2abc4e7d7bad%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Best IDEs for Ruby on Rails

2014-02-24 Thread Yin Wang
We are developing tools for ruby and rails and released a plugin for 
sublime for searching symbols:

  https://github.com/sourcegraph/sourcegraph-sublime

It's based on a global index we are building for open source ruby code so 
that you can accurately search for examples of a particular class, method 
etc. The plugin is at a starting point but we hope to develop it further. I 
like emacs too and we are thinking about also making plugins for emacs and 
vim.

Let us know what you think.



On Wednesday, January 15, 2014 4:18:05 AM UTC-8, arca0 wrote:

 Sublime Text is quite impressive, but I could not switch to it after 
 having used emacs for a while. I'm aware emacs is rather difficult to 
 grasp, at least at the beginning, but it's so customizable and great for 
 productivity I sincerely doubt I'll ever use anything else for any 
 programming language.

 However, emacs does not come with rails-specific plugins and it requires 
 some tweaking before it can be used as a complete development environment. 
 If you are feeling adventurous, however, by all means check this splendid 
 post about configuring emacs for rails: http://t.co/VJaNEXXGh0

 On Tuesday, 14 January 2014 09:22:07 UTC+1, Adrien Siami wrote:

 Sublime is very cool, particularly with some neat features such as symbol 
 lookup, and plugins (rspec, haml / slim, coffeescript, etc)

 I have tried many editors / IDEs and I always fall back to sublime text.

 On Saturday, March 16, 2013 5:40:37 AM UTC+1, Jason Hsu, Rubyist wrote:

 What are your favorite IDEs for Ruby on Rails?  Are there any good IDEs 
 that IMMEDIATELY flag problems the way Eclipse does in Android 
 development?  Given the importance of testing, I'd like to use a tool that 
 immediately and automatically flags problems.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/c5fec774-fefe-485a-a706-eeda622974dd%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.