EzDevInfo.com

carmen

A repository of geographic regions for Ruby

Rails carmen-rails gem, find subregion name by subregion code

am using carmen rails gem for to select country and subregion. after implemented database saving the country code and subregion code.

I can get the country name from code using this
@country_name = Carmen::Country.coded(country_code)

Now i want to get subregion name from subregion code.

Help me to solve this problem.


Source: (StackOverflow)

ruby attr_accessor missing method

New to RoR, I'm using the Carmen gem, running a rake gives me the error:

Failed: NoMethodError: undefined method `excluded_states=' for Carmen:Module

but the gem includes the attr_accessor method with :excluded_states in the args.

Doesn't the attr_accessor method automagically create the `excluded_states=' setter method?


Source: (StackOverflow)

Advertisements

How to pre select a state in Rails Carmen state_select

What are the options I can pass in a state_select. I am trying to do :selected => state and its not working.

<%= f.state_select :state, 'US', {:prompt => '--Select One--', :selected => state}, :tabindex => autotab, :id => 'state_select, :state => state'%>

Source: (StackOverflow)

Carmen-rails undefined method "-"

Using carmen-rails to generate a country select element in my billing address form.

 country_select(:card, :country, {priority: ['United States', 'Canada']}, id: 'country')

The above usage causes the following error:

 NoMethodError: undefined method `-' for {:priority=>["United States", "Canada"]}:Hash

I have tried leaving out the priority option but the issues remains.


Source: (StackOverflow)

how to give id with f.country_select in carmen gem

Hi I am using gem 'carmen-rails' In my view I have written this

<%= f.country_select :country, prompt: 'Please select a country',
                                   :id=>'curr-country' %>

but its not taking this id 'curr-country'. Please guide how to give id in this. Thanks in advance.


Source: (StackOverflow)

Carmen gem include Carmen no method error (nothing to do with nil)

I'm using the Carmen gem, and in the documentation, it says to

require 'carmen'
include Carmen

When I run Carmen in the rails console, everything works fine. But when I run on the actual website, I get the error:

undefined method `include' for #UsersController ....

Thanks


Source: (StackOverflow)

Carmen Robotics

I have been working with Carmen http://carmen.sourceforge.net/ for a while now, and I really like the software but I need to make some changes inside the source code.

I am therefore interesting in some students reports/projects there have been working with Carmen, or any documentation of the source code.

I have been reading the documentation on the webpage for Carmen, but with all respect I think the literature there is a bit outdated and insufficient.


Source: (StackOverflow)

Ruby carmen 'NameError'

I am using the carmen gem and following the instructions there. When I execute these statements:

require 'carmen'
include Carmen

us = Country.named('United States')

I get a

NameError: uninitialized constant Country

even though I have required and included Carmen. require returns true and include returns Object


Source: (StackOverflow)

carmen_rails country_select wrong number of arguments (3 for 0)

Trying to get carmen_rails up and running to add country and subregion(state) to my home-rolled user registration and came across an issue I'm having w/ little help from any online searches (at least from what I can find).

Installed

gem 'carmen-rails', '~> 1.0.0'

Following the github instructions (https://github.com/jim/carmen-rails), the following code should be inserted into my registration page:

<%= simple_form_for @user do |f| %>
  <%= f.input :country_code do %>
    <%= f.country_select :country_code, {object: f.object, prompt: 'Country'} %>
  <% end %>
<% end %>

I'm currently using Rails 4.0.0 and Bootstrap 3 RC2 so my registration code looks like this (along with the standard form setup):

<div class="form-group">
  <%= f.label :country, class: "col-md-4 control-label" %>
  <div class="col-md-8">
    <%= f.country_select :country, {priority: %w(US CA), prompt: "Please select a country", class: "form-control"}  %>
  </div>
</div>

and validation section from app/models/user.rb

validates :country, presence: true
validates :subregion, presence: true

I get the error below and can't figure out the root cause or resolution. Any help is greatly appreciated!

wrong number of arguments (3 for 0)

I was getting the error below, but think it was resolved by restarting the rails server

undefined method `country_select' for ..

Source: (StackOverflow)

Unbrick F.C.E. Carmen Hard Brick after Flashing Fail

I have a BIG problem. After I tried to flash my own custom-made F.C.E. Carmen Firmware, flash failed at 41% and Carmen restarted herself. All ok, now Carmen's logo appears for 3 seconds and after that, a black screen appears. If I press enter, there appears some text such as in the picture I attached. If anyone knows a method to unbrick my Carmen, it will be appreciated. Sorry if I post one the wrong Stack Site but there is no F.C.E. Carmen thread. Error


Source: (StackOverflow)

Why is carmen-rails not defaulting the saved state?

I am using carmen-rails for state dropdown. The state drop down dynamically updates when country is updated but on edit page, the state drop down is not defaulting to the saved state value. Can anyone help?

FYI - I am passing the saved state value as locals parameter u

<div id="order_state_code_wrapper">
  <% parent_region ||= params[:parent_region] %>
  <% if parent_region.nil? %>
    <em>Please select a country above</em>
  <% else %>
    <% country = Carmen::Country.coded(parent_region) %>
    <% if country.nil? %>
       <em>Please select a country above</em>
    <% elsif country.subregions? %>
       <%= subregion_select(:user, :subregion_iso2, parent_region) %>
    <% else %>
       <%= text_field(:user, :subregion_iso2) %>
    <% end %>
  <% end %>
</div>

Source: (StackOverflow)

Rails Carmen get Country name and State name from code

I am using the Carmen gem to render a country select in Rails. The country is stored as Code in the database. How can I get the "Full name" back from this code?

gem 'carmen-rails', '~> 1.0.0.beta3'

<%= f.country_select :country, prompt: 'Please select a country' %>

I tried several options, none of them worked so far! For example:

Carmen::country_name(@profile.country)

Leading to error:

undefined method `country_name' for Carmen:Module

Second try:

in profiles_controller:

@profile = Profile.find(params[:id])
@country = Carmen::Country.named( @profile.country )  

In profiles index view:

<%= @country.official_name %>

This leads to error:

undefined method `official_name' for nil:NilClass

Why is my application failing?


Source: (StackOverflow)

Ruby on Rails - Carmen gem: undefined method `country_select' for #

I'm pulling my hair out with this one. I've tried installing the Carmen gem, then uninstalling it and trying this as a plugin, then uninstalling the plugin and re-installing the gem, restarting the server but nothing seems to help.

Doesn't matter what I do, the code can't seem to find the "country_select" method. It always fails on this line:

<%= f.country_select :country_code, {priority: %w(US CA)}, prompt: 'Please select a country' %>

I'm using Ruby 1.9.3
carmen v1.0.0.beta2
carmen-rails v1.0.0.beta3

I really need to get this working but have no idea how to further this along. Please help...


Source: (StackOverflow)

Exploiting F.C.E Carmen's Bootloader

I'm wondering if it is possible to exploit F.C.E. Carmen's Bootloader to make it load unsigned apps.

I'm working at something similar to a root unlock but I can't find the right library to hook my code in. I need the exact reference that needs to be imported in Carmen in order to gain SIU Acces on Carmen. A reference example is "!She'll import @fce_lib1.CDA" which imports all Carmen Standard LibS such as IO export and BIOS Modules.

This is my code in Progressive Carmen+:

!She'll import @fce_lib1.CDA
!She'll import @fce_carmen.IO
!She'll import @fce_bootloader / 1 -a (0x0000002111)

> Load param_18 as Var (0x000002343 _ 0x00001231 _ 0x00000143201 _0x000004353)
> ram_load (load: libmap.CDA / argument = VAR)
> vid.vga_consoleUI.trx* - loader.do (0x0000021)

Do
 If system.io = res.com_ then
    me.system.argument = true
 Else
     unload/=3409
 End if
End do 
!System.map =- 2

send_*0x0000002111
send()

Try
  Loader/send_*0x0000002111 =-23
    catch.exception(fail.safe_@54436)
    ui.crash = 1
    digital_ 100011011010101111010110100010101
End try

Load _Carmen/UI.script_pack_
   do.exception(9893)
   map.0x0000002111
   kernel.sect_boot_*(0x00000000001)
Boot = safe_mode(0x0002350231111)
Reboot = on.exception_

End Load

My code works fine until it gets rejected by Carmen with this error "Carmen failed to assign a certificate to your aplication. You may be a victim of a potentially unwanted app! Error code is 893A".

Why? This error ocours when my exploit tries to move segment A0001 to Carmen's BIOS Partition.


Source: (StackOverflow)

Add custom country to Carmen

For my Ruby on Rails application, I have the Carmen gem installed in order to access country data and auto create country fields (for example in the mailing address field for the user).

However, for the purposes of this application, Puerto Rico needs to be considered a separate country. Sometime last year Carmen was updated to remove PR from the list of countries but I was wondering if there was a way to add it back.

Example of how I'm currently using Carmen:

<%= f.country_select :country_residence, prompt: ' ' %>

Source: (StackOverflow)