I''m seeing a handful of gem bugs on rails3 that are going unresolved because the fix breaks the gem on rails2. What is the preferred way to add rails version conditions to a gem? Is checking the Rails::VERSION::STRING what folks should be doing? if Rails::VERSION::STRING.start_with?("3") do rails 3 stuff else do what u were doing end Seems like that would break something once Rails 4 comes out. ;-) Pointers to best practices appreciated. Thanks Tony Primerano -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Oct 27, 9:09 am, Tony Primerano <tony.primer...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Seems like that would break something once Rails 4 comes out. ;-)Couldn''t you do this? if Rails::VERSION::STRING.to_i >= 3 puts "at least rails 3" else puts "rails 2 or lower" end -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
yeah that works better. :-) How other gems are handling this. It looks like acts_as_ferret is only supporting Rails3 in > 0.5 so no need for version checks there (unfortunately it isn''t quite rails 3 ready yet). On Oct 27, 9:41 am, Tim Shaffer <timshaf...-BUHhN+a2lJ4@public.gmane.org> wrote:> On Oct 27, 9:09 am, Tony Primerano <tony.primer...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Seems like that would break something once Rails 4 comes out. ;-) > > Couldn''t you do this? > > if Rails::VERSION::STRING.to_i >= 3 > puts "at least rails 3" > else > puts "rails 2 or lower" > end-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.