Updating version-mixed models, controllers, views to Current Rails


#1

Hi all,

My shared hosting provider updated Rails last week with no prior
warning… so I’ve spent the last week finding what’s been broken in
my Rails app and finding out how to fix those problems.

I’ve noticed that parts of the app that still have some type of error
are parts of the app that are from the original app version. Other
parts of the app that do work were made in a slightly newer version of
Rails (though not with the current version that I was upgraded to
unexpectedly.) There doesn’t seem to be a difference in how I wrote
(or generated,) the code for the models, views, and controllers…
but somehow one side works (the slightly newer Rails-created MVC)
while the other side (the older, original MVC) do not work.

Is there a way (that I’ve missed,) whereby I can refresh all of the
MVC for my app so that it’s as if I had generated MVC files in the new
Rails? I remember reading about a way to do something like that in
the past in Rails, but I can’t remember what I’m searching for. Any
idea?

Thanks,
Andy


#2

On 14 Jan 2009, at 18:38, summea wrote:

Rails (though not with the current version that I was upgraded to
unexpectedly.) There doesn’t seem to be a difference in how I wrote
(or generated,) the code for the models, views, and controllers…
but somehow one side works (the slightly newer Rails-created MVC)
while the other side (the older, original MVC) do not work.

Is there a way (that I’ve missed,) whereby I can refresh all of the
MVC for my app so that it’s as if I had generated MVC files in the new
Rails? I remember reading about a way to do something like that in
the past in Rails, but I can’t remember what I’m searching for. Any
idea?

Well you could use the generators to regenerate all that jazz but it
would overwrite everything you’ve done. You’d probably learn more by
working out what the differences are and fixing them.

Fred


#3

Thanks for the reply-–

That’s the problem… as far as I have checked examples of both ones
that work and ones that don’t (new and old,) I haven’t seen a
difference in either the models, views, or controllers… which is why
it’s frustrating. In particular, the parts that aren’t working have
to do with route paths in Views. Like in a form:

<% @journals.each_with_index do |journal, i| %>

> <%=h journal.title %> <%=h journal.created_at.to_s(:long) %> <% #= link_to 'Show', journal %> <%= link_to 'Edit', edit_journal_path(journal) %> <% #= link_to 'Delete', journal, :confirm => 'Are you sure?', :method => :delete %> <% end %>

(I commented out the lines that aren’t working)

And this worked in the last version I was using (2.0.2, I think.) The
current version I’m using is 2.2.2.

Andy


#4

Thanks for the comment.

I think I’ve found the issue…

In the previous version of Rails I was using, I was able to write
this:
<% form_for(@journal) do |f| %>

But now I have to write it like this (apparently):
<% form_for(:journal) do |f| %>

Thanks,
Andy

On Jan 14, 11:51 am, Ar Chron removed_email_address@domain.invalid


#5

And this worked in the last version I was using (2.0.2, I think.) The
current version I’m using is 2.2.2.

Andy

The first thing I would do is to freeze the Rails code into my
application.