Giter Club home page Giter Club logo

rfm's People

Contributors

emptyflask avatar ginjo avatar lardawge avatar littleforest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rfm's Issues

Decimal point versus decimal comma

In my XML a number is like 3,14. Changing the format in the Filemaker-layout doesn't seem to work. Is there an easy way to change that in rfm? So I get 3.14 and my number will be right?

Authentication

Sorry if this is obvious but I am trying to figure out how I can allow users to authenticate to filemaker (existing accounts). The FileMaker Database does not store the passwords in a table. They are stored internally in the "Security/Accounts" settings.

What I was hoping to do is some how in the config file apply the user entered credentials (from a login screen) and if they are authentic access the database with them. I hope that makes sense...

Maybe this can already be done but I am to new at all this to figure it out...

Rubygems exception when installing ginjo-rfm 2.0.0 on some platforms

On a stock Snow Leopard machine (rubygems v1.3.5), I get an error from rubygems when installing ginjo-rfm 2.0.0.

 multi_json requires RubyGems version >= 1.3.6

Ginjo-rfm does not require multi_json. Nor does the minimum required ActiveSupport (>= 2.3.5). On Ubuntu 8.10 with rubygems 1.3.5, I get a buffer overflow error when installing ginjo-rfm 2.0.0. In both of these cases, ginjo-rfm installs and runs correctly regardless of the errors.

Am currently combing the gem & gemspec for clues as to why these errors are showing up.

Rails-2.0: Credentials

Hi Wiliam,

is there a way to store the FileMaker-Password, which is currently in rfm.yml in the newly introduced credententials.yml.enc?

Best Regards and many Thanks!
Christian

FileMaker DATA API

Hi William,
Although this is technical not an issue.
We are enjoying your work for our FileMaker Ruby projects!

We where wondering if you have any plans to create a ruby/rails gem for the FileMaker data API,
of if you are available for contract work.

Kind regards,
Maarten
[email protected]

undefined method `encoding' for #<Array:0x007f91ee3a2028>

I get "undefined method encoding for #Array:0x007f91ee3a2028" whenever I tried to call all from a layout.

My environment:
Ruby: 2.2.3
ginjo-rfm: 3.0.11

Gemset

  * actionmailer (3.2.22)
  * actionpack (3.2.22)
  * activemodel (3.2.22)
  * activerecord (3.2.22)
  * activeresource (3.2.22)
  * activesupport (3.2.22)
  * acts-as-taggable-on (3.5.0)
  * addressable (2.4.0)
  * arel (3.0.3)
  * ast (2.2.0)
  * astrolabe (1.3.1)
  * bcrypt (3.1.10)
  * bcrypt-ruby (3.1.5)
  * better_errors (2.1.1)
  * binding_of_caller (0.7.2)
  * builder (3.0.4)
  * bundler (1.11.2)
  * byebug (8.2.1)
  * callsite (0.0.11)
  * capybara (2.5.0)
  * chosen_rails (0.1.0)
  * chunky_png (1.3.5)
  * climate_control (0.0.3)
  * cliver (0.3.2)
  * cocaine (0.5.8)
  * coderay (1.1.0)
  * coffee-rails (3.2.2)
  * coffee-script (2.4.1)
  * coffee-script-source (1.10.0)
  * compass (0.12.7)
  * compass-normalize (1.1.2)
  * compass-rails (1.0.3)
  * crack (0.4.3)
  * crass (1.0.2)
  * cucumber (2.1.0)
  * cucumber-core (1.3.1)
  * cucumber-rails (1.3.0)
  * daemons (1.2.3)
  * database_cleaner (1.5.1)
  * debug_inspector (0.0.2)
  * delayed_job (4.1.1)
  * delayed_job_active_record (4.1.0)
  * devise (1.5.3)
  * diff-lcs (1.2.5)
  * draper (2.1.0)
  * dynamic_form (1.1.4)
  * email_spec (1.6.0)
  * epoxy (0.3.1)
  * erubis (2.7.0)
  * eventmachine (1.0.8)
  * execjs (2.6.0)
  * factory_girl (4.1.0)
  * factory_girl_rails (4.1.0)
  * faker (1.6.1)
  * fssm (0.2.10)
  * gherkin3 (3.1.2)
  * ginjo-rfm (3.0.11)
  * git-version-bump (0.15.1)
  * haml (4.0.7)
  * haml-rails (0.4)
  * hashdiff (0.2.3)
  * highline (1.7.8)
  * hike (1.2.3)
  * httpclient (2.7.0.1)
  * humanize (1.1.0)
  * i18n (0.7.0)
  * journey (1.0.4)
  * jquery-rails (2.1.3)
  * jquery-ui-rails (4.1.1)
  * json (1.8.3)
  * kaminari (0.16.3)
  * launchy (2.4.3)
  * letter_opener (1.4.1)
  * libv8 (3.16.14.13)
  * mail (2.5.4)
  * meta_request (0.3.4)
  * methlab (0.1.0)
  * mime-types (1.25.1)
  * mini_portile2 (2.0.0)
  * minitest (5.8.3)
  * multi_json (1.11.2)
  * multi_test (0.1.2)
  * mysql2 (0.3.20)
  * nested_form (0.3.2)
  * newrelic_rpm (3.14.1.311)
  * nice_password (1.0.0)
  * nokogiri (1.6.7.1)
  * nokogumbo (1.4.7)
  * oj (2.12.14)
  * options (2.3.2)
  * orm_adapter (0.0.7)
  * paperclip (3.2.0)
  * paperclip-storage-ftp (1.2.7)
  * parallel (1.6.1)
  * parallel_tests (2.2.1)
  * parser (2.2.3.0)
  * pg (0.18.4)
  * poltergeist (1.8.1)
  * polyglot (0.3.5)
  * power_assert (0.2.6)
  * powerpack (0.1.1)
  * pr_geohash (1.0.0)
  * progress_bar (1.0.5)
  * rack (1.4.7)
  * rack-cache (1.5.1)
  * rack-contrib (1.4.0)
  * rack-mini-profiler (0.9.8)
  * rack-ssl (1.3.4)
  * rack-test (0.6.3)
  * rails (3.2.22)
  * railties (3.2.22)
  * rainbow (2.0.0)
  * rake (10.4.2)
  * rdbi (0.9.1)
  * rdbi-driver-odbc (0.1.2)
  * rdbi-driver-sqlite3 (0.9.1)
  * rdiscount (2.1.8)
  * rdoc (3.12.2)
  * ref (2.0.0)
  * request_store (1.2.1)
  * retriable (2.1.0)
  * rollbar (2.7.1)
  * rsolr (1.0.13)
  * rspec-collection_matchers (1.1.2)
  * rspec-core (2.99.2)
  * rspec-expectations (2.99.2)
  * rspec-mocks (2.99.4)
  * rspec-rails (2.99.0)
  * rubocop (0.35.1)
  * ruby-odbc (0.99992)
  * ruby-progressbar (1.7.5)
  * safe_yaml (1.0.4)
  * sanitize (4.0.1)
  * sass (3.2.19)
  * sass-rails (3.2.5)
  * shoulda (3.5.0)
  * shoulda-context (1.2.1)
  * shoulda-matchers (2.8.0)
  * sprockets (2.2.3)
  * sqlite3 (1.3.11)
  * sqlite3-ruby (1.3.3)
  * sunspot (1.3.3)
  * sunspot_rails (1.3.3)
  * sunspot_solr (1.3.3)
  * sunspot_test (0.4.0)
  * susy (1.0.9)
  * test-unit (3.1.5)
  * therubyracer (0.12.2)
  * thin (1.6.4)
  * thor (0.19.1)
  * tilt (1.4.1)
  * tins (1.6.0)
  * treetop (1.4.15)
  * typelib (0.1.0)
  * tzinfo (0.3.46)
  * uglifier (2.7.2)
  * validate_url (1.0.2)
  * vcr (3.0.1)
  * warden (1.2.4)
  * webmock (1.22.3)
  * websocket-driver (0.6.3)
  * websocket-extensions (0.1.2)
  * whiskey_disk (0.6.24)
  * xpath (2.0.0)
  * yajl-ruby (1.2.1)

Code that errors:

@fm_database = @fm_server[@filemaker_config.database]
fm_super_categories = @fm_database['Web_Super_Categories']

@fm_super_categories.all.each do |super_category|
  ..stuff
 end

NoMethodError: undefined method `name' for Hash

We have found an intermittent issue that we cannot reproduce however wondering if anyone can shed some light on this.

The issue is in line 129 of record.rb
field_name = @layout.field_mapping[field.name] || field.name rescue field.name

If I understand this correctly
field is a hash that has been extended to add a method .name.
Using core_ext.rb rfm_extend_members - def each
adding Fmpxmlresult::Resultset::Column

The error below shows that the Hash doesn't have the method .name

NoMethodError: undefined method name' for {"name"=>"addr_full", "data"=>{"__content__"=>" NSW "}}:Hash /data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/record.rb:129:inrescue in block in initialize'
/data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/record.rb:129:in block in initialize' /data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/record.rb:127:ineach'
/data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/record.rb:127:in initialize' /data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/base.rb:111:innew'
/data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/base.rb:111:in rescue in new' /data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/base.rb:108:innew'
/data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/record.rb:171:in block in build_records' /data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/utilities/core_ext.rb:94:inblock in each'
/data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/utilities/core_ext.rb:91:in each' /data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/utilities/core_ext.rb:91:ineach'
/data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/record.rb:170:in build_records' /data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/resultset.rb:128:ininitialize'
/data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/layout.rb:285:in new' /data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/layout.rb:285:inget_records'
/data/myi/shared/bundled_gems/ruby/2.0.0/gems/ginjo-rfm-2.1.7/lib/rfm/layout.rb:179:in all' /data/myi/releases/20140407053924/app/jobs/load_fm_job.rb:101:inblock in sync_parents'
/data/myi/shared/bundled_gems/ruby/2.0.0/gems/mongoid-3.1.6/lib/mongoid/unit_of_work.rb:39:in unit_of_work' /data/myi/releases/20140407053924/app/jobs/load_fm_job.rb:77:insync_parents'
/data/myi/releases/20140407053924/app/jobs/load_fm_job.rb:16:in perform' /data/myi/shared/bundled_gems/ruby/2.0.0/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:inpublic_send'
/data/myi/shared/bundled_gems/ruby/2.0.0/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in dispatch' /data/myi/shared/bundled_gems/ruby/2.0.0/gems/celluloid-0.15.2/lib/celluloid/calls.rb:67:indispatch'
/data/myi/shared/bundled_gems/ruby/2.0.0/gems/celluloid-0.15.2/lib/celluloid/actor.rb:322:in block in handle_message' /data/myi/shared/bundled_gems/ruby/2.0.0/gems/celluloid-0.15.2/lib/celluloid/actor.rb:416:inblock in task'
/data/myi/shared/bundled_gems/ruby/2.0.0/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:55:in block in initialize' /data/myi/shared/bundled_gems/ruby/2.0.0/gems/celluloid-0.15.2/lib/celluloid/tasks/task_fiber.rb:13:inblock in create'

We are simply doing a FMLayout.all call.
It's really weird it doesnt happen all the time, it only happens sometimes in our production system. During our nightly Sync. Also other .all calls work for other layouts.

Really stuck here only thing i can think to do is hack record.rb line 129
from
field_name = @layout.field_mapping[field.name] || field.name rescue field.name
to
field_name = @layout.field_mapping[field.name] || field.name rescue field[name]

Rake error - ArgumentError: unknown keyword: start

Using ginjo-rfm 3.0.12 seems to break Rake on Rails 5.1.1. Whenever I try to run any rake task I get the following error:

ArgumentError: unknown keyword: start
/home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/activesupport-5.1.7/lib/active_support/core_ext/module/delegation.rb:155:in delegate' /home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/listen-3.1.5/lib/listen/backend.rb:29:in class:Backend'
/home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/listen-3.1.5/lib/listen/backend.rb:10:in <module:Listen>' /home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/listen-3.1.5/lib/listen/backend.rb:9:in <top (required)>'
/home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in require' /home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in block in require'
/home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:258:in load_dependency' /home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in require'
/home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/listen-3.1.5/lib/listen/listener.rb:5:in <top (required)>' /home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in require'
/home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in block in require' /home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:258:in load_dependency'
/home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in require' /home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/listen-3.1.5/lib/listen.rb:3:in <top (required)>'
/home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/bundler-2.0.1/lib/bundler/runtime.rb:81:in require' /home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/bundler-2.0.1/lib/bundler/runtime.rb:81:in block (2 levels) in require'
/home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/bundler-2.0.1/lib/bundler/runtime.rb:76:in each' /home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/bundler-2.0.1/lib/bundler/runtime.rb:76:in block in require'
/home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/bundler-2.0.1/lib/bundler/runtime.rb:65:in each' /home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/bundler-2.0.1/lib/bundler/runtime.rb:65:in require'
/home/user/.rvm/gems/ruby-2.4.1@rails_project/gems/bundler-2.0.1/lib/bundler.rb:114:in require' /home/user/rails/rails_project/config/application.rb:7:in <top (required)>'
/home/user/rails/rails_project/Rakefile:4:in require_relative' /home/user/rails/rails_project/Rakefile:4:in <top (required)>'
/home/user/.rvm/gems/ruby-2.4.1@rails_project/bin/ruby_executable_hooks:24:in eval' /home/user/.rvm/gems/ruby-2.4.1@rails_project/bin/ruby_executable_hooks:24:in

'

When I remove the ginjo-rfm gem, Rake works as normal. I tried downgrading the gem to no avail.

object.send :eval is not supported in some Rubies

Hi there,

I'm using Rubinius and have found that this line in the SAX parser doesn't work under their Ruby implementation. I'm guessing that this is because the private eval method is not documented (as far as I can tell). I believe this line can be replaced by obj.instance_eval(code) -- I've tested this under Rubinius and it seems to work.

undefined method `id' for {}:Policy

I know I just posted this as a comment to another issue, but found that this might be something entirely different.
I'm using Rfm models and after a Policy.create (or .new followed by as save) I got "undefined method `id' for {}:Policy". When accessing .id on my instance.
It has happend a few times, no exceptions are raised in Rfm, the model is just an empty hash after create.
I created a few tests and ran it alot of times and it did not happen, so far I've only seen it in production :-(
I am using the newest version of Rfm.
I've set it to log requests, no request is registered in my Rails app, and nothing is registered in FM, it is like new/initialize in rfm record can fail and just return a blank hash. I see there is some commented out rescue code that seems to indicate that it has been an issue before. I'd really like to solve this, and I'll be glad to cook up a PR on this, but I need some hints to where I should go look for this issue.
I would hate to go back to write FM we stuff in PHP :-(

Creating a record in a layout with a portal is causing problems

[edited, got my bugs crossed!]
Hi there,

I've encountered a problem when trying to create a new record using v3.0.9. This time I've used HTTPie to get the problematic XML, so it should be completely legit. This is on FileMaker 14, so I guess there's a chance that the issue is due to an API change, or even a FileMaker bug ...

Anyway, the offending XML is here. When parsing this XML, I get the following error:

     NoMethodError:
       undefined method `[]' for nil:NilClass

The error comes from here:

     # /home/asp/src/ginjo-rfm/lib/rfm/metadata/datum.rb:26:in `portal_field_element_close_callback'
     # /home/asp/src/ginjo-rfm/lib/rfm/utilities/sax_parser.rb:387:in `get_callback'
     # /home/asp/src/ginjo-rfm/lib/rfm/utilities/sax_parser.rb:305:in `receive_end_element'
     # /home/asp/src/ginjo-rfm/lib/rfm/utilities/sax_parser.rb:779:in `_end_element'
     # /home/asp/src/ginjo-rfm/lib/rfm/utilities/sax_parser.rb:852:in `sax_parse'
     # /home/asp/src/ginjo-rfm/lib/rfm/utilities/sax_parser.rb:852:in `block in run_parser'
     # /home/asp/src/ginjo-rfm/lib/rfm/utilities/sax_parser.rb:852:in `open'
     # /home/asp/src/ginjo-rfm/lib/rfm/utilities/sax_parser.rb:852:in `run_parser'
     # /home/asp/src/ginjo-rfm/lib/rfm/utilities/sax_parser.rb:634:in `build'
     # /home/asp/src/ginjo-rfm/lib/rfm/utilities/sax_parser.rb:627:in `build'
     # /home/asp/src/ginjo-rfm/lib/rfm/utilities/sax_parser.rb:136:in `parse'
     # /home/asp/src/ginjo-rfm/lib/rfm/utilities/connection.rb:85:in `parse'
     # /home/asp/src/ginjo-rfm/lib/rfm/layout.rb:325:in `get_records'
     # /home/asp/src/ginjo-rfm/lib/rfm/layout.rb:265:in `create'
     # /home/asp/src/ginjo-rfm/lib/rfm/base.rb:260:in `create_from_new'
     # /home/asp/src/ginjo-rfm/lib/rfm/base.rb:273:in `block in create'
     # /home/asp/.gem/ruby/2.1.2/gems/activesupport-4.2.2/lib/active_support/callbacks.rb:88:in `call'
     # /home/asp/.gem/ruby/2.1.2/gems/activesupport-4.2.2/lib/active_support/callbacks.rb:88:in `_run_callbacks'
     # /home/asp/.gem/ruby/2.1.2/gems/activesupport-4.2.2/lib/active_support/callbacks.rb:776:in `_run_create_callbacks'
     # /home/asp/.gem/ruby/2.1.2/gems/activesupport-4.2.2/lib/active_support/callbacks.rb:81:in `run_callbacks'
     # /home/asp/src/ginjo-rfm/lib/rfm/base.rb:270:in `create'
     # /home/asp/src/ginjo-rfm/lib/rfm/base.rb:206:in `save!'

I did a pry and it seems to be baulking at the WLG Current Location Sort By First::Qty field.
It looks like it fails because the metadata for the portal is not available in the XML. Like I say, don't know if that's a FM14 thing, or what. I was able to get around it with this patch, but I suppose that will cause problems somewhere else. I have another issue that I'll submit separately.

Authentication

I'm trying to include a simple user authentication into my application, based on a filemaker database (using the ginjo-rfm gem). I've written several user authentication systems in rails and ActiveRecord, but not with ginjo-rfm. I'm only looking to base the authentication on :username and :password (both plain text) allready stored in the FM-database. I'm totally clueless on how to do this without ActiveRecord as an ORM/wrapper.

Progress so far: The Rails app is connected to the DB trough RFM and it works as a charm, and I'm able to get and set to the database without problems. The problem occurs when trying to write the model and controller for user authentication, ActiveRecord standard methods like 'find_by', or 'where' won't work. Is there anyway to rephrase the way the authentication logic is written?

Has anyone done this? Could someone point me in the right direction? If so, I'll be forever grateful!

Invalid Date

Sometimes I get an Invalid Date error while doing a find request, which crashes Rfm. I know this points to the data integrity of the FileMaker Database Field but that sometimes is out of my control (depending on who built the database).

I think what is going on is if the date field in filemaker does not have a valid date then when Rfm is converting the data to a ruby date it raises an exception...

Search Result Set

I'm pulling down my results specified by the client, without using elastic search, is there an easy way to search results, outside of the .find method?

For example I find all my data and store it in @fmResults

@fmResults[0] = {:field1 => "Duck", :field2 => "123", :field3 => "Kyle"} 
@fmResults[1] = {:field1 => "Cat", :field2 => "234", :field3 => "Jim"} 
@fmResults[2] = {:field1 => "Dog", :field2 => "567", :field3 => "Alex"} 
@fmResults[3] = {:field1 => "Ardvark", :field2 => "890", :field3 => "Jim Bob"}
  • If i search "23" it should return @fmResults[0] & @fmResults[1]
  • If I search "Jim" it should return @fmResults[1] & @fmResults[3]

I know I can build a form with all the fields and pass them to the RFM .find method, but that is going to involve multiple search fields for each field and I'd prefer to have a single field.

Thanks for any suggestions

Case problems with CaseInsensitiveHash

Using a Rails 2.3.11 app with ginjo-rfm 1.4.3, fields referenced without exactly correct case will fail with

<somefield> does not exists as a field in the current Filemaker layout.

It appears that Rfm::CaseInsensitiveHash is broken, probably clashing with ActiveSupport which modifies the top Hash class.

Duplicated portal table name? Will it merge the field-definition?

Hi,

Looking at your spec data at spec/data/resultset_with_duplicate_portals.xml I see there is many occurrences of ProjectLineItemsSubItems_PLI in your XML sample file.

I want to ask, is this possible for FileMaker to output such a thing? And if so, does the portal_meta going to merge all field definitions into a single entity?

The field_meta is easy to get, but the portal_meta is keyed to the table name, so when I see many occurrences of ProjectLineItemsSubItems_PLI, I wonder is that possible. Tks :)

:max_records => 10

I am trying to limit the number of records returned in a search. Does not seem to work. I am a beginner at rails...

Using Rails 3.2

class LineItems < Rfm::Base
  config :layout => 'ruby_line_items'
end

class HomeController < ApplicationController
  def item_list
    @result = LineItems.find({"job number" => "myclient-12-001"},{ :sort_field => "Filename" , :max_records => 10 }) 
  end
end

It just returns all the records unsorted. Any help would be much appreciated. :)

Trying to set a portal field's value doesn't work in 3.0.9

Hi there,

In my 2.1.7 code I had something like the following:

class MyModel < Rfm::Base
  config(database: 'db',
         layout: 'layout')

end

m = MyModel.new('some portal::some value' => 'testing')

In 2.1.7, this would work and I'd be able to call m.save! to update the value in the portal.
In 3.0.9, assuming that the database and layout exist, the last line above produces the following error:

/home/asp/.gem/ruby/2.1.2/gems/ginjo-rfm-3.0.9/lib/rfm/base.rb:162:in `instance_variable_set': `@some portal::some value' is not allowed as an instance variable name (NameError)
        from /home/asp/.gem/ruby/2.1.2/gems/ginjo-rfm-3.0.9/lib/rfm/base.rb:162:in `block in update_attributes'
        from /home/asp/.gem/ruby/2.1.2/gems/ginjo-rfm-3.0.9/lib/rfm/base.rb:156:in `each'
        from /home/asp/.gem/ruby/2.1.2/gems/ginjo-rfm-3.0.9/lib/rfm/base.rb:156:in `update_attributes'
        from /home/asp/.gem/ruby/2.1.2/gems/ginjo-rfm-3.0.9/lib/rfm/record.rb:148:in `initialize'
        from /home/asp/.gem/ruby/2.1.2/gems/ginjo-rfm-3.0.9/lib/rfm/record.rb:130:in `new'

As with my last bug report this is on FM14. I have been able to get around this for now with this patch, uncommenting the commented-out implementation of instance_variable_set. I've not really tried to understand what the different versions of the method are doing though.

:sort_field not working with field mapping

module Rdat
  class Asset < Rfm::Base
      include Rfm::Config
      config :field_mapping => { "production_ruby::post_status" => 'post_status',
                                             "client_ruby::name" => 'client_name'
    }
.     
.
.
  end
end

r = Rdat::Asset

ready_for_masking = r.find({:client_name => "MyClient"},:sort_field => "production_ruby::post_status")
#Returns records

ready_for_masking = r.find({:client_name => "MyClient"},:sort_field => "post_status")

#Throws an error:
Rfm::Error::FieldMissingError: FieldMissingError occurred: (FileMaker Error #102)

trouble getting value_lists from layout

Encountered an error when trying to read the value_lists on a particular layout. The layout has a field that is using the value list...

Can't remember the exact error but it was something like "can't convert string to integer"

A note on recent issues & pull requests

Apologies for being so late to respond to the recent PRs and issues. I've been buried in projects that have taken me far from ruby, but I'm making my way back and intend to address each of these issues & PRs.

Thanks for your patience,
William

call FileMaker-Scripts

Dear, makers of this really smart gem!

Could it be possible to implement a new feature?

Altough your gem is made to deal with records, it could be the a fine tool to call FileMaker-Scripts on the FileMaker-Server and get the results back?
I know, like many things in FileMaker, this would be a fairish hack, but a great help for many cases.

Situation:
In near Future, it may be that with the restFM-Interface, the dealing with Scripts would become easier, but there are a lot of older versions running and there are reasons to maintain a older Version and don't update.
Examples: In File-Maker its common to rename Fields. If you have a big system with a lot fo xml-Interfaces and a 100% FileMaker-Developer in the team or the chief of the company also develops in the System, you can tell them 100 times that it's not allowed to rename Fields - you will have a problem.
If you want to push larger texts to a older FileMaker, it can not receive by 'put', so it blocks. You have to call a FileMaker-Script, which gets it by 'get'.
This are only two examples - there are more reasons.

To call a FileMaker-Script over the XML - Interface, you have to call a layout, and then you can call a script see: XML-Interface (url: "..&-script="). This is the easier part.
More complex is to deliver back the result over the xml-interface:
You have to call the Script by ".prefind", then give a UID with the parameter, the FileMaker-Script does his work, creates a record with this uid and the result, and in the same step, the XML - Interface finds and picks up this record and delivers it back within the xml - result. Yes, sorry, this is a real Hack!! But, this steps could be implemented once in this gem and given a description or a example for the FileMaker-Side. I've written such a logic in Xojo for interacting with FileMaker and it works very stable and also on the older FileMaker-versions.
If this FileMaker-Script runs with full privileges, it is then able to do anything on the FileMaker-Side, also on other layouts and Tables.

Problem: give Script-Parameters to FileMaker
In the XML - interface, FileMaker can only receive a single Script-Parameter in one string.
Since FileMaker-16, fileMaker can deal with json. To have Json-Ability on older Versions you can install Base-Elements on FileMaker-Server. A other way to give FileMaker multiple Script-Parameters is to deal with Custom-Functions. One Example, i've written, i've attached.

If you or we can implement this new Feature to this gem, i could deliver the counterpart as a example-FileMaker-File and we could deliver this with your gem.

Many thanks and best Regards in advance,
chmich

SetPar_Demo.fmp12.zip

Model.new fields missing if done after a failed Model.find

If I run Mover.new first, I get the expected behavior, and @model.field_names is correctly populated.

Running Mover.find(...) with an empty result set and then Mover.new creates an empty hash, and @model.field_names is empty.

Seems like Rfm is relying on the first connection to Filemaker to populate the layout, even if that connection doesn't return any layout data.

Tested with Ruby 2.2.0, Filemaker 13, rfm 3.0.9

NoMethodError: undefined method `coerce' for nil:NilClass

Hi there,

I'm using ginjo-rfm 2.1 at the moment and it works well. I thought I would try upgrading to 3.0.4, but when I did a find on a model object I got the following:

NoMethodError: undefined method `coerce' for nil:NilClass
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/metadata/datum.rb:40:in `handler_callback'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/utilities/sax_parser.rb:288:in `run_callback'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/utilities/sax_parser.rb:267:in `receive_end_element'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/utilities/sax_parser.rb:644:in `_end_element'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/utilities/sax_parser.rb:717:in `sax_parse'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/utilities/sax_parser.rb:717:in `block in run_parser'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/utilities/sax_parser.rb:717:in `open'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/utilities/sax_parser.rb:717:in `run_parser'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/utilities/sax_parser.rb:482:in `build'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/utilities/sax_parser.rb:475:in `build'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/utilities/sax_parser.rb:102:in `parse'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/utilities/connection.rb:80:in `parse'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/layout.rb:324:in `get_records'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/layout.rb:232:in `find'
    from /home/asp/.rvm/gems/ruby-2.1.2/gems/ginjo-rfm-3.0.4/lib/rfm/base.rb:107:in `find'

This was using the ox parser, but I also tried with the Nokogiri parser and got the same problem (albeit with a slightly different stack trace), and I've also tried using bleeding-edge git. Unfortunately I am unable to post the data here that caused the issue as it contains sensitive private information. If necessary though, I can try to make an anonymised version.

The issue seems to arise because the Rfm::Metadata::Datum object that raises the error only has one attribute, name. As a result, the code in Cursor#clean_member overwrites the datum's attributes hash with just the value of name. I will make a pull request with a suggested fix, but I don't really understand the code so I'm not sure if my approach makes any sense.

Cheers.

Errors connecting

Hello,
Trying to use Rfm via Rails to connect to FM Server 10 remote database.
Installed Ruby/Gems/Rails via Bitnami Stack...install went fine, was able to create and launch
Rails browser fine...installed original Rfm first, then advised by Geoff to install 'ginjo-rfm'.

Using just basic code like the following....
---------------------- snip ----------------------------------------------

require 'rubygems'
require 'rfm'

fm = Rfm::Server.new({
:host => "192.168.50.71",
:account_name => "admin",
:password => "???",
:ssl => false,
:log_actions => true,
:log_responses => true
})

fm["MAVS_GUI_TEMPDB"]["General_List_Components"].all.each do |record|
puts record["Title"]
end

puts "DONE!"

----------------------------- snip -----------------------------------

but when run...I get back:

C:\Ruby>ruby r11.rb
http://192.168.50.71:80/fmi/xml/fmresultset.xml?-db=MAVS_GUI_TEMPDB&-lay=General_List_Components&-findall=
date: ["Thu, 31 May 2012 17:53:55 GMT"]
server: ["Apache/2.2.21 (Unix) PHP/5.3.8 mod_jk/1.2.23"]
mime-version: ["1.0"]
cache-control: ["no-cache="set-cookie"", "must-revalidate"]
set-cookie: ["fmi-cookie=fmi-cookie; Path=/; Version=1"]
expires: ["Tue, 03 May 1988 14:40:00 GMT"]
ms-author-via: ["DAV"]
x-frame-options: ["SameOrigin"]
transfer-encoding: ["chunked"]
content-type: ["text/xml; charset=utf-8"]

d"></metad
ata>
C:/RubyStack-3.2.3-0/ruby/lib/ruby/gems/1.9.1/gems/ginjo-rfm-2.0.2/lib/rfm/resultset.rb:131:in check_for_errors': UnableToOpenFileError occurred: (FileMaker Error #802) (Rfm::Error::UnableToOpenFileError) from C:/RubyStack-3.2.3-0/ruby/lib/ruby/gems/1.9.1/gems/ginjo-rfm-2.0.2/lib/rfm/resultset.rb:78:ininitialize'
from C:/RubyStack-3.2.3-0/ruby/lib/ruby/gems/1.9.1/gems/ginjo-rfm-2.0.2/lib/rfm/layout.rb:256:in new' from C:/RubyStack-3.2.3-0/ruby/lib/ruby/gems/1.9.1/gems/ginjo-rfm-2.0.2/lib/rfm/layout.rb:256:inget_records'
from C:/RubyStack-3.2.3-0/ruby/lib/ruby/gems/1.9.1/gems/ginjo-rfm-2.0.2/lib/rfm/layout.rb:166:in all' from r11.rb:16:in'


Curious that "expires" property is set to 1988,..but oh well....

Cutting and pasting first line (the http line) into the rails browser window yields an "Unable to connect" response..

Also tried:
----------------------- snip --------------------------------------------
require 'rubygems'
require 'rfm'

CONFIG = {
:host => "192.168.50.71",
:port => 80,
:account_name => "admin",
:password => "???",
:ssl => false,
:database => "MAVS_GUI_TEMPDB"
}

LAYOUT = "Project Varables" # yes, someone misspelled it

fm = Rfm::Server.new(CONFIG)

results = fm[CONFIG[:database]][LAYOUT].any

puts results
puts "done"


which returns:

C:\Ruby>ruby r7.rb
C:/RubyStack-3.2.3-0/ruby/lib/ruby/gems/1.9.1/gems/ginjo-rfm-2.0.2/lib/rfm/resultset.rb:131:in check_for_errors': UnableToOpenFileError occurred: (FileMaker Error #802) (Rfm::Error::UnableToOpenFileError) from C:/RubyStack-3.2.3-0/ruby/lib/ruby/gems/1.9.1/gems/ginjo-rfm-2.0.2/lib/rfm/resultset.rb:78:ininitialize'
from C:/RubyStack-3.2.3-0/ruby/lib/ruby/gems/1.9.1/gems/ginjo-rfm-2.0.2/lib/rfm/layout.rb:256:in new' from C:/RubyStack-3.2.3-0/ruby/lib/ruby/gems/1.9.1/gems/ginjo-rfm-2.0.2/lib/rfm/layout.rb:256:inget_records'
from C:/RubyStack-3.2.3-0/ruby/lib/ruby/gems/1.9.1/gems/ginjo-rfm-2.0.2/lib/rfm/layout.rb:171:in `any'

from r7.rb:19:in `'

Which is the shortest error message that I've gotten I think...

The database stored on the FM Server 10 (not Advanced Server) has IWP and XML (and pretty much all others)
protocols enabled. The server and database are operational and being used either by FMP clients thru-out the
building,...and via an old JavaScript program that automates an operation that hopefully will be replaced by our
Rails process.

Pretty experienced programmer (though not Ruby/Rails) otherwise, but feel like I've exhausted almost all
avenues. Get the sense that it's not local software, but some Server setting somewhere, but that's speculative.
Would appreciate anyone who can shed some light on how to fix and/or proceed.

C:\Ruby>ruby --version
ruby 1.9.3p125 (2012-02-16) [i386-mingw32]

from 'gem list'
rails (3.2.3, 1.2.3)
rfm (1.0.0)
ginjo-rfm (2.0.2)

(Are original 'rfm' and 'ginjo-rfm' colliding? )

activemodel (3.2.3)
activerecord (3.2.3, 1.15.3)
activeresource (3.2.3)   
activesupport (3.2.3, 1.4.2)

Server: FM Server 10 installed on Intel MacMini on SnowLep
Clieints: FMP 10.0v1 installed on Windows7
FM Server..."ssl" is not enabled...

Any help or advice would be most greatly appreciated,
Thank you,
Jim

Can -edit save multiple data with max-repeat="3"

I have a field named Bonus that is so-called Repeating like this:

<metadata>
  <field-definition max-repeat="3" name="Bonus" result="text" ... />
</metadata>
...
<record mod-id="123" record-id="122">
  <field name="Bonus">
    <data>one</data>
    <data>two</data>
    <data>three</data>
  </field>
</record>

And RFM return an array conveniently for me.

['one', 'two', 'three']

My question is, how do we save the record back with the -edit query command?

My guess is that it is entirely impossible with the current setup, just want to know anyone over here deal with repeating values.

Usage of Operators

Hi,
Thanks for this great gem. It has helped me save (and possibly many developers worldwide) weeks (possibly months) of coding time.

I would like to find records in FM server that have a date field greater than my value.
How can i achieve this?
It is stated in FM XML documentation that you send the "field.op" as query string. Here is a passage from docs:

For example, the following request searches for values greater than 100,000 in the “Salary” field
on the “Budget” layout. The resulting data is displayed using the “ExecList” layout, which does not
include the “Salary” field.

http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=Budget&Salary=100000&Salary.op=gt&-find&-lay.response=ExecList

In RFM i can only use ".find(:field => value)". How can i use comparison operators?
Thanks.

Timeout Error

I am new to filemaker, I have installed filemaker server. I have install rfm gem,

Following is my config in config/rfm.yml
:host: "192.168.1.20"
:ssl: false
:timeout: 10
:port: 16000
:account_name: "somename"
:password: "somepass"
:database: "dbname"
:ssl_certificate: '/path/to/certificatefile/certificate.pem'

I have created user model & tried to fetch first record as follow,
@user = User.find(1);
puts "First User: " + @user.to_s

I am getting timeout error. (Net::ReadTimeout (Net::ReadTimeout):)

Filemaker WPE bad response results in Errno::ENOENT: No such file or directory @ rb_sysopen

It’s possible for this io variable to contain just about anything, and as long as it isn’t obviously XML, then it will try to open the string as a file:

# lib/rfm/utilities/sax_parser.rb:838
        def run_parser(io)
          parser = Nokogiri::XML::SAX::Parser.new(self)
          parser.parse case
                       when (io.is_a?(File) || io.is_a?(StringIO))
                         io
                       when io[/^</]
                         StringIO.new(io)
                       else
                         File.new(io)
                       end
        end

I'm still not sure what Filemaker was responding with, since restarting the WPE fixed the problem, but it was really confusing to see Errno::ENOENT in multiple apps' log files.

If this happens again I'll take a closer look and hopefully make a pull request to at least make the error more descriptive.

Split completely from lardawge/rfm?

The project has significantly diverged from the original lardawge/rfm repo, so should it still be considered a fork in github? Splitting it would allow repository searches, but on the other hand it would make the project slightly less visible. Thoughts?

Filemarker requirements?

Hi Bill,

Couldn't find any other way to contact you other than this way, so apologies for the "issue"

I'm completely new for Filemaker, but I was recently asked if it was possible to integrate a Filemaker database at a friend's office with a cloud-based website built in Rails. Clearly, this gem looks like it'll work for this, but I'm just wondering if there are any additional requirements that I'm not yet aware of.

For example, there's Filemaker Pro and then there's Server. Would this gem be able to connect with just the Pro version?

Thanks,
Alex

No raise even if raise_on_401 is set to true.

ginjo-rfm-3.0.12
Rails 6.0.2.2

When executing the Find method, no exception is thrown if there is no such record.

sample code


Models / art.rb

class Art < Rfm::Base
  config :layout => 'English_Form_View',
   :host => "127.0.0.1",
   :port => 16020,
   :account_name => "admin",
   :password => "xxxxxxxx",
   :database => "FMServer_Sample",
   :raise_on_401 => true,
   :ssl => false
end


Controllers / art_controller.rb

class ArtController < ApplicationController
...
  def search
    begin
        @records = Art.find "TextForSearch" => params[:Search]
        flash[:notice] = Art.config[:raise_on_401]  # true
      end
    rescue Rfm::Error::NoRecordsFoundError
      flash[:notice] = "'#{params[:Search]}' could not be found.”
      @records = Art.all
    end
  end
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.