Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

rails4 compatibility #20

Open
wants to merge 5 commits into from
@grncdr

Hey, this isn't backwards compatible with rails3, but was necessary to get the form_helper to work with rails4.

@Nowaker

Is there any reason why it's still not merged? Is the gem maintained?

Using this for now:

gem 'carmen-rails', :git => 'https://github.com/freerunningtechnologies/carmen-rails', :branch => 'rails4'

cbrunsdon and others added some commits
@cbrunsdon cbrunsdon move prompt above priority options
Change-Id: I33f72753105fa45af43cba78eb57e9b35912aabd
8abfb71
@adammathys adammathys Add to_s to Rails.version
Due to rails/rails#8501.

Change-Id: I3a5580e12a9f4bc013bb98db9aa6d8c3e11bf0c5
92d6d10
@tamird

Nitpicking a bit, but this is not the right way to do it.

2.0.0p0 :020 > '4.0.0.beta1' > '4.0.0.1'
 => true
2.0.0p0 :021 > Gem::Version.new('4.0.0.beta1') > Gem::Version.new('4.0.0.1')
 => false

String comparison semantics are different from Gem::Version comparison semantics.

@CDainMiller
Collaborator

This gem is still being maintained but is possibly switching owners. Thanks for these pull requests though guys and this is one of the high priority things to review when we are done with the process for carmen-rails migration.

@bcm

any updates? now that rails 4 is released it would be nice to get a compatible version of carmen released.

@bcm

ping!

@paulwittmann

any update? carmen-rails is unusable for me right now =(

@bcm

looks like this got merged instead: 38ea9c0

I guess @jim wasn't aware we were all watching this issue :)

@pablocrivella

is this gem still unusable on rails 4? does anyone know any alternatives?

@Nowaker

@freerunningtech Would you mind releasing your https://github.com/freerunningtechnologies/carmen-rails rails4 branch as a gem, e.g. carmen-rails4? The author doesn't care about this gem so you are our last hope.

@jim
Owner

Sorry I haven't gotten around to dealing with this issue yet. If anyone is interested in helping maintain the project, please let me know.

@bcm

38ea9c0 appears to have made the gem rails 4 compatible. looks like somebody just needs to push a new version of the gem.

@CDainMiller
Collaborator

Sorry guys, been so busy. We could definitely use some help maintaining this.

@Nowaker
@jim
Owner
jim commented

@Nowaker That branch doesn't merge cleanly into master, and when I resolve the conflicts, it still has failing tests.

I've just released 1.0.1. Can anyone running into a problem with Rails 4 give it a go and see if it resolves your issues?

@alanheppenstall

@jim It works great for me in 4.0.0 and in 4.0.3 in a modified version of your example app (https://github.com/alanheppenstall/carmen-rails-example-rails4test)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 9, 2013
  1. @grncdr

    rails4 compatibility

    grncdr authored
Commits on Feb 15, 2013
  1. @grncdr
  2. @grncdr
Commits on Mar 20, 2013
  1. @cbrunsdon

    move prompt above priority options

    cbrunsdon authored
    Change-Id: I33f72753105fa45af43cba78eb57e9b35912aabd
Commits on Mar 25, 2013
  1. @adammathys

    Add to_s to Rails.version

    adammathys authored
    Due to rails/rails#8501.
    
    Change-Id: I3a5580e12a9f4bc013bb98db9aa6d8c3e11bf0c5
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/carmen/rails/action_view/form_helper.rb
View
11 lib/carmen/rails/action_view/form_helper.rb
@@ -83,6 +83,7 @@ def region_options_for_select(regions, selected=nil, options={})
options.stringify_keys!
priority_region_codes = options['priority'] || []
region_options = ""
+ region_options += options_for_select [[options['prompt'], '']] if options['prompt']
unless priority_region_codes.empty?
unless regions.respond_to?(:coded)
@@ -101,7 +102,6 @@ def region_options_for_select(regions, selected=nil, options={})
main_options = regions.map { |r| [r.name, r.code] }
main_options.sort!{|a, b| a.first.to_s <=> b.first.to_s}
- main_options.unshift [options['prompt'], ''] if options['prompt']
region_options += options_for_select(main_options, selected)
region_options.html_safe
@@ -124,8 +124,8 @@ def region_options_for_select(regions, selected=nil, options={})
# country_select_tag('country_code', {priority: ['US', 'CA']}, class: 'region')
#
# Returns an `html_safe` string containing the HTML for a select element.
- def country_select_tag(name, value, options={})
- subregion_select_tag(name, value, Carmen::World.instance, options)
+ def country_select_tag(name, value, options={}, html_options={})
+ subregion_select_tag(name, value, Carmen::World.instance, options, html_options)
end
# Generate select and subregion option tags for the given object and method. A
@@ -172,6 +172,11 @@ def determine_parent(parent_region_or_code)
end
end
+ if Rails.version.to_s > '4'
+ class InstanceTag < ActionView::Helpers::Tags::Base
+ end
+ end
+
class InstanceTag
def to_region_select_tag(parent_region, options = {}, html_options = {})
html_options = html_options.stringify_keys
Something went wrong with that request. Please try again.