Make rails 1.1 code 1.0-compliant


#1

Hello,

I’m working on a rails 1.1 app on my mac, but my web host hasn’t
upgraded from 1.0 to 1.1 yet, so the below code, which works on my
machine, doesn’t work on the web server:

controller

def compare_fields
name = params[:person][:name]
@exists = Album.count([“name like :n”, {:n => name}])

render :update do |page|
if @exists > 0
page.replace_html ‘messages’, “#{params[:person][:name]} exists
in the database.”
end
end
end

In particular, I get the following error message:

ActionController::MissingTemplate (Missing template
…/config/…/app/views/updat
e.rhtml)

So, my question is this: how can I do this in rails 1.0? (My knowledge
of JavaScript is very spotty, but I should be able to understand a
solution.)

I can provide more code (eg. from the view) if necessary.

Thanks,
Eric


#2

eric katerman wrote:

Hello,

I’m working on a rails 1.1 app on my mac, but my web host hasn’t
upgraded from 1.0 to 1.1 yet, so the below code, which works on my
machine, doesn’t work on the web server:

controller

def compare_fields
name = params[:person][:name]
@exists = Album.count([“name like :n”, {:n => name}])

render :update do |page|
if @exists > 0
page.replace_html ‘messages’, “#{params[:person][:name]} exists
in the database.”
end
end
end

In particular, I get the following error message:

ActionController::MissingTemplate (Missing template
…/config/…/app/views/updat
e.rhtml)

So, my question is this: how can I do this in rails 1.0? (My knowledge
of JavaScript is very spotty, but I should be able to understand a
solution.)

I can provide more code (eg. from the view) if necessary.

Thanks,
Eric

Hi Eric,

What you need to do is to freeze Rails 1.1 into your vendor directory.
This basically lets you run your application with the exact version of
Rails you used to develop it. RJS templates weren’t present in 1.0 so
there’s not a simple answer to downgrade your app.

http://weblog.rubyonrails.org/articles/2006/03/31/freeze-is-cool-so-freeze-for-goodness-sake

I believe the best way to freeze Rails into your vendor directory is to
this command from the root of your Rails app:

rake freeze_gems

This should put the Rails gems into vendor, which you can then upload to
your server. It’s always a good idea to upload your app to the server
with the version of Rails you made it with.

Jeff C.man


#3

Hi Eric,

What you need to do is to freeze Rails 1.1 into your vendor directory.
This basically lets you run your application with the exact version of
Rails you used to develop it. RJS templates weren’t present in 1.0 so
there’s not a simple answer to downgrade your app.

http://weblog.rubyonrails.org/articles/2006/03/31/freeze-is-cool-so-freeze-for-goodness-sake

I believe the best way to freeze Rails into your vendor directory is to
this command from the root of your Rails app:

rake freeze_gems

This should put the Rails gems into vendor, which you can then upload to
your server. It’s always a good idea to upload your app to the server
with the version of Rails you made it with.

Jeff C.man

Hi Jeff,

Thanks so much. This certainly does the trick.

Eric