Running MySQL/Lightty on r1139. The following happens after posting
through
the admin interface. No textfilter was used/selected. Not sure if this
the
same as Trac ticket #948 or not. Didn’t want to enter a ticket if it is
the
same issue.
NOTE: The published date was not populated with anything and I entered a
past date. When I return to the admin/articles page, it is there, but
the
same error happens after clicking on it. Also it breaks when trying to
load
the homepage?
NoMethodError in Admin/content#show
Showing app/views/admin/content/show.rhtml where line #11 raised:
undefined method `filter_text_for_controller’ for #String:0x225e59c
Extracted source (around line #11):
8:
<%=h @article.title %>
9:
10:
11:
<%= @article.full_html %>
12:
Posted: <%=h @article.published_at.to_formatted_s(:long_weekday) %> by <%=h @article.author %>
13:
Last updated: <%=h @article.updated_at.to_formatted_s(:long_weekday) %>
Looking at the data stored in the table shows that body_html is NULL?
The
textfilter that is stored looks like this:
— !ruby/object:TextFilter
attributes:
name: none
filters: — []
params: — {}
description: None
markup: none
new_record: true
Trac #1005. For some reason It won’t come up though. I have an update
for
some reason the @article.text_filter is returning a YAML String instead
of a
TextFilter object. This is probably the culprit for Trac #1006 as well.
I
confirmed this in the console loading the saved new post(a) and an older
one
that still renders correctly(b):
On Tue, 2006-07-18 at 21:52 -0500, Steve L. wrote:
I have an update for some reason the @article.text_filter is returning
a YAML String instead of a TextFilter object. This is probably the
culprit for Trac #1006 as well. I confirmed this in the console
loading the saved new post(a) and an older one that still renders
correctly(b):
When I encountered symptoms like this, it’s because my database schema
was hosed. Probably happened when I tried to fix the migrations 6
months ago. My database had an extra table that wasn’t being used but
had the same name as a variable in the code. AR wasn’t very happy about
that and instantiated YAML strings instead of objects.
In my case, I dropped the table and things started working.
So, you might want to give your schema a close look-see. Especially
check for extra tables.
I’ve been meaning to write a Typo database lint tool… It would ensure
that no extra tables exist, all table references work, no duplicates,
etc. Ah, if only I had a bit more time…
I’ve never personally edited my typo table structure. I do know one
of the migrations ran and turned my UTF-8 data into ASCII. Only
because I had some language characters outside the overlap in the
charactersets.
I’m suspicious of the change in the ContentObserver class from 2 weeks
ago. It seems to be responsible for populating the html_fields before
a save. I suspect if I remove the commentted line my body_html field
will get populated again.
This is a database/active record problem, not a text filter problem.
The problem, plain and simple, is that article.text_filter is supposed
to be a TextFilter object, but instead it’s a block of YAML. I’m not
quite sure how that could happen–it shouldn’t ever have been YAML in
the first place, so it’s not like it missed a conversion step.
Oh, wait–there it is. Your schema is broken. You have a
‘text_filter’ field in contents; there should only be a
‘text_filter_id’ field. Back up your db and drop text_filter, and you
should be okay. Somehow you missed that migration.
The admin page saves text_filter not text_filter_id. So I can’t use
filters
now.
More confusingly it saves text_filter by name instead of just id. Seems
to
be some confusion between how contents table and blogs table work. Not
sure how you would like this resolved.
A little research on populate_html_fields shows it sprang into
existence between r1004 and r1033 in the content.rb model. As near as
I can see it was always expecting a controller of some kind and never
the instance of Content that the ContentObserver(also r1033) sends in.
At any rate I show 18 tables. Is that right?
| contents |
| triggers |
NULL | || body | text | YES |
|| permalink | varchar(255) | YES | | NULL |
| name | varchar(255) | YES | | NULL | |
On 7/18/06, Scott B. [email protected] wrote:
had the same name as a variable in the code. AR wasn’t very happy about
Maybe I’m being slow, but what’s the problem with this? This matches
mine, and mine seems to work fine.
Out of curiosity, do your tests pass if you run ‘rake test’? Make
sure you have a test DB defined and it’s not the same as your
production DB, or Bad Things happen.
You told me to drop text_filter from contents. Migration #14 seems to
support this as things were moved to the INTEGER column text_filter_id
from
STRING column text_filter. So how can the text_filter_id ever be a
string
name? Things work in admin if you don’t want a TextFilter because it
defaults to ‘none’.
(this is r1142)
rake test
First batch:
Finished in 25.067883 seconds.
That should show you the differences between your currently loaded
schema and the one that you’d get if you installed a new DB from
scratch. Can you do that and send me the diff?
Scott
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.