Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining ruby methods in template is no longer possible #835

Closed
gurix opened this issue Dec 9, 2019 · 2 comments
Closed

Defining ruby methods in template is no longer possible #835

gurix opened this issue Dec 9, 2019 · 2 comments

Comments

@gurix
Copy link

gurix commented Dec 9, 2019

After I had updated some bundles I was no longer be able to call methods I defined in the template using the ruby filter:

ruby: 
  def hello_world(text)
    "Hello #{text}"
  end

p= hello_world('Johny')

This code throws the following error: «undefined method `hello_world' for ...»

I fixed it by using class methods instead, but this is just an ugly hack:

ruby: 
  def self.hello_world(text)
    "Hello #{text}"
  end

p= hello_world('Johny')

I cannot see why this behaviour changed especially because I did not update slim itself. Slim version ist slim-4.0.1.
Any ideas? My guess is that it must be some gem I updated before but I cannot see what's related with slim that could cause this behaviour. There is the diff of my Gemfile.lock.

diff --git a/Gemfile.lock b/Gemfile.lock
index 1f7db044..e0e48a3a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -49,9 +49,9 @@ GEM
       i18n (>= 0.7, < 2)
       minitest (~> 5.1)
       tzinfo (~> 1.1)
-    addressable (2.6.0)
-      public_suffix (>= 2.0.2, < 4.0)
-    ahoy_matey (2.2.0)
+    addressable (2.7.0)
+      public_suffix (>= 2.0.2, < 5.0)
+    ahoy_matey (2.2.1)
       addressable
       browser (~> 2.0)
       device_detector
@@ -61,17 +61,17 @@ GEM
       request_store
       safely_block (>= 0.2.1)
       user_agent_parser
-    airbrussh (1.3.1)
+    airbrussh (1.4.0)
       sshkit (>= 1.6.1, != 1.7.0)
     arel (9.0.0)
-    autoprefixer-rails (9.6.0)
+    autoprefixer-rails (9.7.1)
       execjs
     bcrypt (3.1.13)
-    better_errors (2.5.0)
+    better_errors (2.5.1)
       coderay (>= 1.0.0)
       erubi (>= 1.0.0)
       rack (>= 0.9.0)
-    bindex (0.7.0)
+    bindex (0.8.1)
     binding_of_caller (0.8.0)
       debug_inspector (>= 0.0.1)
     bootstrap (4.3.1)
@@ -79,11 +79,11 @@ GEM
       popper_js (>= 1.14.3, < 2)
       sassc-rails (>= 2.0.0)
     breadcrumbs_on_rails (3.0.1)
-    browser (2.5.3)
-    bson (4.5.0)
+    browser (2.6.1)
+    bson (4.6.0)
     builder (3.2.3)
     byebug (11.0.1)
-    capistrano (3.11.0)
+    capistrano (3.11.2)
       airbrussh (>= 1.0.0)
       i18n
       rake (>= 10.0.0)
@@ -94,22 +94,21 @@ GEM
     capistrano-rails (1.4.0)
       capistrano (~> 3.1)
       capistrano-bundler (~> 1.1)
-    capybara (3.20.2)
+    capybara (3.29.0)
       addressable
       mini_mime (>= 0.1.3)
       nokogiri (~> 1.8)
       rack (>= 1.6.0)
       rack-test (>= 0.6.3)
-      regexp_parser (~> 1.2)
+      regexp_parser (~> 1.5)
       xpath (~> 3.2)
-    capybara-screenshot (1.0.22)
+    capybara-screenshot (1.0.23)
       capybara (>= 1.0, < 4)
       launchy
-    carmen (1.1.2)
+    carmen (1.1.3)
       activesupport (>= 3.0.0)
-    chartkick (3.2.0)
-    childprocess (0.9.0)
-      ffi (~> 1.0, >= 1.0.11)
+    chartkick (3.2.2)
+    childprocess (3.0.0)
     chunky_png (1.3.11)
     codemirror-rails (5.16.0)
       railties (>= 3.0, < 6.0)
@@ -130,52 +129,52 @@ GEM
     country_select (4.0.0)
       countries (~> 3.0)
       sort_alphabetical (~> 1.0)
-    crass (1.0.4)
+    crass (1.0.5)
     css_parser (1.7.0)
       addressable
     debug_inspector (0.0.3)
-    device_detector (1.0.1)
-    devise (4.6.2)
+    device_detector (1.0.2)
+    devise (4.7.1)
       bcrypt (~> 3.0)
       orm_adapter (~> 0.1)
-      railties (>= 4.1.0, < 6.0)
+      railties (>= 4.1.0)
       responders
       warden (~> 1.2.3)
     diff-lcs (1.3)
     diffy (3.3.0)
-    docile (1.3.1)
-    dotenv (2.7.2)
-    dotenv-rails (2.7.2)
-      dotenv (= 2.7.2)
+    docile (1.3.2)
+    dotenv (2.7.5)
+    dotenv-rails (2.7.5)
+      dotenv (= 2.7.5)
       railties (>= 3.2, < 6.1)
     email_spec (2.2.0)
       htmlentities (~> 4.3.3)
       launchy (~> 2.1)
       mail (~> 2.7)
-    errbase (0.1.1)
-    erubi (1.8.0)
+    errbase (0.2.0)
+    erubi (1.9.0)
     erubis (2.7.0)
-    et-orbi (1.2.1)
+    et-orbi (1.2.2)
       tzinfo
-    exception_notification (4.3.0)
-      actionmailer (>= 4.0, < 6)
-      activesupport (>= 4.0, < 6)
+    exception_notification (4.4.0)
+      actionmailer (>= 4.0, < 7)
+      activesupport (>= 4.0, < 7)
     execjs (2.7.0)
-    factory_bot (5.0.2)
+    factory_bot (5.1.1)
       activesupport (>= 4.2.0)
-    faker (1.9.3)
-      i18n (>= 0.7)
+    faker (2.7.0)
+      i18n (>= 1.6, < 1.8)
     ffi (1.11.1)
-    font-awesome-sass (5.8.1)
+    font-awesome-sass (5.11.2)
       sassc (>= 1.11)
-    fugit (1.2.1)
+    fugit (1.3.3)
       et-orbi (~> 1.1, >= 1.1.8)
       raabro (~> 1.1)
-    geocoder (1.5.1)
+    geocoder (1.5.2)
     globalid (0.4.2)
       activesupport (>= 4.2.0)
     google_timezone (0.0.5)
-    haml (5.1.1)
+    haml (5.1.2)
       temple (>= 0.8.0)
       tilt
     haml-rails (2.0.1)
@@ -221,9 +220,9 @@ GEM
       nokogiri (>= 1.6.0)
       ruby_parser (~> 3.5)
     htmlentities (4.3.4)
-    i18n (1.6.0)
+    i18n (1.7.0)
       concurrent-ruby (~> 1.0)
-    i18n-js (3.2.2)
+    i18n-js (3.4.1)
       i18n (>= 0.6.6)
     i18n_data (0.8.0)
     jquery-rails (4.3.5)
@@ -243,28 +242,28 @@ GEM
     launchy (2.4.3)
       addressable (~> 2.3)
     libv8 (7.3.492.27.1)
-    loofah (2.2.3)
+    loofah (2.3.1)
       crass (~> 1.0.2)
       nokogiri (>= 1.5.9)
     mail (2.7.1)
       mini_mime (>= 0.1.1)
-    mail_form (1.7.1)
-      actionmailer (>= 3.2, < 6)
-      activemodel (>= 3.2, < 6)
+    mail_form (1.8.0)
+      actionmailer (>= 5.0)
+      activemodel (>= 5.0)
     marcel (0.3.3)
       mimemagic (~> 0.3.2)
     method_source (0.9.2)
-    mime-types (3.2.2)
+    mime-types (3.3)
       mime-types-data (~> 3.2015)
-    mime-types-data (3.2019.0331)
+    mime-types-data (3.2019.1009)
     mimemagic (0.3.3)
-    mini_mime (1.0.1)
+    mini_mime (1.0.2)
     mini_portile2 (2.4.0)
     mini_racer (0.2.6)
       libv8 (>= 6.9.411)
-    minitest (5.11.3)
-    mongo (2.9.0)
-      bson (>= 4.4.2, < 5.0.0)
+    minitest (5.13.0)
+    mongo (2.11.0)
+      bson (>= 4.6.0, < 5.0.0)
     mongoid (6.4.4)
       activemodel (>= 5.1, < 6.0.0)
       mongo (>= 2.5.1, < 3.0.0)
@@ -290,8 +289,8 @@ GEM
     net-scp (2.0.0)
       net-ssh (>= 2.6.5, < 6.0.0)
     net-ssh (5.2.0)
-    nio4r (2.3.1)
-    nokogiri (1.10.3)
+    nio4r (2.5.2)
+    nokogiri (1.10.5)
       mini_portile2 (~> 2.4.0)
     orm_adapter (0.5.0)
     popper_js (1.14.5)
@@ -301,15 +300,16 @@ GEM
     pry-byebug (3.7.0)
       byebug (~> 11.0)
       pry (~> 0.10)
-    public_suffix (3.0.3)
-    puma (3.12.1)
+    public_suffix (4.0.1)
+    puma (4.2.1)
+      nio4r (~> 2.0)
     raabro (1.1.6)
     rack (2.0.7)
     rack-accept (0.4.5)
       rack (>= 0.4)
-    rack-mini-profiler (1.0.2)
+    rack-mini-profiler (1.1.3)
       rack (>= 1.2.0)
-    rack-protection (2.0.5)
+    rack-protection (2.0.7)
       rack
     rack-test (1.1.0)
       rack (>= 1.0, < 3)
@@ -330,8 +330,8 @@ GEM
     rails-dom-testing (2.0.3)
       activesupport (>= 4.2.0)
       nokogiri (>= 1.6)
-    rails-html-sanitizer (1.0.4)
-      loofah (~> 2.2, >= 2.2.2)
+    rails-html-sanitizer (1.3.0)
+      loofah (~> 2.3)
     rails-i18n (5.1.3)
       i18n (>= 0.7, < 2)
       railties (>= 5.0, < 6)
@@ -342,103 +342,104 @@ GEM
       rake (>= 0.8.7)
       thor (>= 0.19.0, < 2.0)
     raindrops (0.19.0)
-    rake (12.3.2)
+    rake (13.0.0)
     rb-fsevent (0.10.3)
     rb-inotify (0.10.0)
       ffi (~> 1.0)
-    redis (4.1.1)
+    redis (4.1.3)
     referer-parser (0.3.0)
-    regexp_parser (1.5.0)
+    regexp_parser (1.6.0)
     request_store (1.4.1)
       rack (>= 1.4)
     responders (2.4.1)
       actionpack (>= 4.2.0, < 6.0)
       railties (>= 4.2.0, < 6.0)
-    roadie (3.5.0)
+    roadie (3.5.1)
       css_parser (~> 1.4)
       nokogiri (~> 1.8)
     roadie-rails (2.1.0)
       railties (>= 5.1, < 6.1)
       roadie (~> 3.1)
-    rotp (4.1.0)
+    rotp (5.1.0)
       addressable (~> 2.5)
-    route_translator (6.0.0)
+    route_translator (7.0.1)
       actionpack (>= 5.0.0.1, < 6.1)
       activesupport (>= 5.0.0.1, < 6.1)
-    rqrcode (0.10.1)
+    rqrcode (1.1.1)
       chunky_png (~> 1.0)
-    rspec (3.8.0)
-      rspec-core (~> 3.8.0)
-      rspec-expectations (~> 3.8.0)
-      rspec-mocks (~> 3.8.0)
-    rspec-collection_matchers (1.1.3)
+      rqrcode_core (~> 0.1.0)
+    rqrcode_core (0.1.0)
+    rspec (3.9.0)
+      rspec-core (~> 3.9.0)
+      rspec-expectations (~> 3.9.0)
+      rspec-mocks (~> 3.9.0)
+    rspec-collection_matchers (1.2.0)
       rspec-expectations (>= 2.99.0.beta1)
-    rspec-core (3.8.0)
-      rspec-support (~> 3.8.0)
-    rspec-expectations (3.8.3)
+    rspec-core (3.9.0)
+      rspec-support (~> 3.9.0)
+    rspec-expectations (3.9.0)
       diff-lcs (>= 1.2.0, < 2.0)
-      rspec-support (~> 3.8.0)
-    rspec-mocks (3.8.0)
+      rspec-support (~> 3.9.0)
+    rspec-mocks (3.9.0)
       diff-lcs (>= 1.2.0, < 2.0)
-      rspec-support (~> 3.8.0)
-    rspec-rails (3.8.2)
+      rspec-support (~> 3.9.0)
+    rspec-rails (3.9.0)
       actionpack (>= 3.0)
       activesupport (>= 3.0)
       railties (>= 3.0)
-      rspec-core (~> 3.8.0)
-      rspec-expectations (~> 3.8.0)
-      rspec-mocks (~> 3.8.0)
-      rspec-support (~> 3.8.0)
-    rspec-support (3.8.0)
-    ruby_parser (3.13.1)
+      rspec-core (~> 3.9.0)
+      rspec-expectations (~> 3.9.0)
+      rspec-mocks (~> 3.9.0)
+      rspec-support (~> 3.9.0)
+    rspec-support (3.9.0)
+    ruby_parser (3.14.1)
       sexp_processor (~> 4.9)
-    rubyzip (1.2.2)
-    safely_block (0.2.1)
-      errbase
+    rubyzip (2.0.0)
+    safely_block (0.3.0)
+      errbase (>= 0.1.1)
     sass (3.7.4)
       sass-listen (~> 4.0.0)
     sass-listen (4.0.0)
       rb-fsevent (~> 0.9, >= 0.9.4)
       rb-inotify (~> 0.9, >= 0.9.7)
-    sass-rails (5.0.7)
-      railties (>= 4.0.0, < 6)
+    sass-rails (5.1.0)
+      railties (>= 5.2.0)
       sass (~> 3.1)
       sprockets (>= 2.8, < 4.0)
       sprockets-rails (>= 2.0, < 4.0)
       tilt (>= 1.1, < 3)
-    sassc (2.0.1)
+    sassc (2.2.1)
       ffi (~> 1.9)
-      rake
     sassc-rails (2.1.2)
       railties (>= 4.0.0)
       sassc (>= 2.0)
       sprockets (> 3.0)
       sprockets-rails
       tilt
-    selenium-webdriver (3.141.0)
-      childprocess (~> 0.5)
-      rubyzip (~> 1.2, >= 1.2.2)
-    sexp_processor (4.12.1)
-    sidekiq (5.2.3)
-      connection_pool (~> 2.2, >= 2.2.2)
-      rack (>= 1.5.0)
-      rack-protection (>= 1.5.0)
-      redis (>= 3.3.5, < 5)
+    selenium-webdriver (3.142.6)
+      childprocess (>= 0.5, < 4.0)
+      rubyzip (>= 1.2.2)
+    sexp_processor (4.13.0)
+    sidekiq (6.0.3)
+      connection_pool (>= 2.2.2)
+      rack (>= 2.0.0)
+      rack-protection (>= 2.0.0)
+      redis (>= 4.1.0)
     sidekiq-cron (1.1.0)
       fugit (~> 1.1)
       sidekiq (>= 4.2.1)
     simple_form (4.1.0)
       actionpack (>= 5.0)
       activemodel (>= 5.0)
-    simplecov (0.16.1)
+    simplecov (0.17.1)
       docile (~> 1.1)
       json (>= 1.8, < 3)
       simplecov-html (~> 0.10.0)
     simplecov-html (0.10.2)
-    sinatra (2.0.5)
+    sinatra (2.0.7)
       mustermann (~> 1.0)
       rack (~> 2.0)
-      rack-protection (= 2.0.5)
+      rack-protection (= 2.0.7)
       tilt (~> 2.0)
     sixarm_ruby_unaccent (1.2.0)
     slim (4.0.1)
@@ -457,13 +458,13 @@ GEM
       actionpack (>= 4.0)
       activesupport (>= 4.0)
       sprockets (>= 3.0.0)
-    sshkit (1.18.2)
+    sshkit (1.20.0)
       net-scp (>= 1.1.2)
       net-ssh (>= 2.8.0)
-    temple (0.8.1)
+    temple (0.8.2)
     thor (0.20.3)
     thread_safe (0.3.6)
-    tilt (2.0.9)
+    tilt (2.0.10)
     turnout (2.5.0)
       i18n (>= 0.7, < 2)
       rack (>= 1.3, < 3)
@@ -471,13 +472,13 @@ GEM
       tilt (>= 1.4, < 3)
     tzinfo (1.2.5)
       thread_safe (~> 0.1)
-    uglifier (4.1.20)
+    uglifier (4.2.0)
       execjs (>= 0.3.0, < 3)
     unicode_utils (1.4.0)
     unicorn (5.5.1)
       kgio (~> 2.6)
       raindrops (~> 0.7)
-    user_agent_parser (2.5.1)
+    user_agent_parser (2.5.2)
     warden (1.2.8)
       rack (>= 2.0.6)
     web-console (3.7.0)
@@ -488,7 +489,8 @@ GEM
     websocket-driver (0.7.1)
       websocket-extensions (>= 0.1.0)
     websocket-extensions (0.1.4)
-    wicked_pdf (1.1.0)
+    wicked_pdf (1.4.0)
+      activesupport
     xpath (3.2.0)
       nokogiri (~> 1.8)
@gurix gurix changed the title Defining runy methods in template is no longer possible Defining ruby methods in template is no longer possible Dec 9, 2019
@aerostitch
Copy link
Contributor

Hi,

This is due to that specific change in tilt which was released in tilt 2.0.10: rtomayko/tilt#343

You have more explanations in rtomayko/tilt#347

Hope that helps,
Joseph

@minad
Copy link
Member

minad commented Jan 1, 2023

Closing, see rtomayko/tilt#347 (comment)

@minad minad closed this as completed Jan 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants