Forum: Ruby on Rails make rails 1.1 code 1.0-compliant

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eric K. (Guest)
on 2006-04-18 05:42
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
Jeff C. (Guest)
on 2006-04-18 06:07
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/...

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
Eric K. (Guest)
on 2006-04-18 06:43
> 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/...
>
> 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
This topic is locked and can not be replied to.