Comments (7)
I just tried to reproduce in a new Rails application using Rails on main and could not:
![Screenshot 2024-02-14 at 2 35 26 PM](https://private-user-images.githubusercontent.com/47848/304854080-07bb0c64-e615-4fcf-be96-041caefbbc56.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1NDI5NzUsIm5iZiI6MTcyMTU0MjY3NSwicGF0aCI6Ii80Nzg0OC8zMDQ4NTQwODAtMDdiYjBjNjQtZTYxNS00ZmNmLWJlOTYtMDQxY2FlZmJiYzU2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIxVDA2MTc1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc1MmQwNjNiZjA0YWIwOGZlODhiNTJkYmM1NDhjNGRiNDJkOTZjMTNkODdiZjY4MDYzMGQyYzY2ODU1NzZmY2UmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.RnmkfEIrooZFvpu3xB7Q8jwMcRPXSMy1SmpRlcW7dWE)
My Ruby version is ruby 3.2.2 (2023-03-30 revision e51014f9c0) [aarch64-linux]
.
What is your Ruby version?
from rails.
I just tried to reproduce in a new Rails application using Rails on main and could not:
My Ruby version is `ruby 3.2.2 (2023-03-30 revision e51014f9c0) [aarch64-linux]`.
What is your Ruby version?
![image](https://private-user-images.githubusercontent.com/73736217/304868017-24e9e9ad-22da-432d-b718-5c777404645d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1NDI5NzUsIm5iZiI6MTcyMTU0MjY3NSwicGF0aCI6Ii83MzczNjIxNy8zMDQ4NjgwMTctMjRlOWU5YWQtMjJkYS00MzJkLWI3MTgtNWM3Nzc0MDQ2NDVkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIxVDA2MTc1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI5NGUwZTdkYTJhYzIzNDUwMGQxYjI3MDZmYmYyMmRiMTRkMzUzZDEzNWMxMzUyNDc4NjgzODJjZTUzNWVmYTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.kZfNwCvRA8JO1rHgOSzDANYNEeM8_hxczS8tZ-oNhag)
I could reproduce it on an apple silicone using ruby version 3.2.2
from rails.
I just tried on apple silicon and linux the following steps:
rails new --dev my_app
cd my_app
bin/rails g scaffold posts title body
bin/rails db:migrate
Then I edited posts/index.html.erb
to add the invalid code, started the server and got the error pointing to the template. I'm also using 3.2.2.
Which steps did you take to reproduce?
from rails.
Oh this is a strange one. This triggers the busted exception:
<ul>
<li><%= link_to post.title, post %></li>
</ul>
<%= link_to "New book", new_book_path %>
but this does not:
<ul>
<li>
<%= link_to post.title, post %>
</li>
</ul>
<%= link_to "New book", new_book_path %>
from rails.
aha! I think maybe the compiled template line isn't matching the source line.
from rails.
Just confirmed this also happens on 7.1
from rails.
Minimum code to regenerate the issue -->
<li><%= link_to post.title, post %></li>
Even if empty spaces are present after closing braces it will result in showing compiled string.
<%= link_to post.title, post %> <empty_spaces>
Problem
- File-
activesupport/lib/active_support/core_ext/erb/util.rb
method -tokenize
- In this
tokenize
method we are not handling end text that is present after the code%>
- Because of this if empty spaces or text is present after code
%>
it will result inraise NotImplementedError
- And the final output will be the compiled code because this method will return nil.
Solution
- Handle the edge case if some text is present at the end in string.
unless source.eos? || source.exist?(/#{start_re}|#{finish_re}/m)
tokens << [:TEXT, source.rest]
source.terminate
end
from rails.
Related Issues (20)
- Rails 7.1 Error when reading active record model from redis cache HOT 6
- [BUG since 2016] cookies.delete does not remove cookies for subsequent requests (ActionController::TestCase) HOT 2
- "Polymorphic associations do not support computing the class." error when creating a record with a `has_one :through` HOT 4
- Null error in DB on relation `belongs_to` HOT 1
- Relax the sqlite3 dependency for Rails 7.1 HOT 4
- [DOC] active record basic guide said `create` would return `false` if failed
- ActiveRecord `attribute :foo, :bar` requires an active connection
- enable_extension in schema dump doesn't contain schema name HOT 1
- PostgreSQL array not decrypting HOT 2
- Behaviour of `autosave` associations has changed on edge HOT 2
- [ActiveRecord] delete_all on has_many with dependent: :restrict_with_error results with nullify HOT 2
- ActiveRecord::AttributeMethods::Serialization::ClassMethods.serialize is not backwards compatible 7.0 -> 7.1 HOT 5
- ActiveRecord: Issue with NULL insertion for serialized empty arrays causing database constraint violations HOT 1
- daterange with `.contains(Date)` results in malformed SQL ActiveRecord::StatementInvalid: PG::InvalidTextRepresentation: ERROR: malformed range literal: "2024-07-17"
- Custom Validators that rely on Date Comparison are now breaking in Rails 7.1/Spec test cases HOT 6
- ActiveRecord CPK issue with lookup by associations HOT 2
- Leveraging button form attribute to simplify front-end integration HOT 1
- [Doc][7.2] Migration versions [8.0] are mixed up in active_record_migrations.md HOT 1
- FormHelper#text_field build value attribute of IPAddr without prefix
- Callbacks / Validations not running for `accepts_nested_attributes_for` relation on certain values, but will run on other values, or when another value is saved together with the problematic value, or when updating the record directly HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rails.