Search Results

Search found 3 results on 1 pages for 'empire29'.

Page 1/1 | 1 

  • How to render a Partial from a Model in Rails 2.3.5

    - by empire29
    I have a Rails 2.3.5 application and Im trying to render several Partials from within a Model (i know, i know -- im not supposed to). The reason im doing this is im integrating a Comet server (APE) into my Rails app and need to push updates out based on the Model's events (ex. after_create). I have tried doing this: ActionView::Base.new(Rails::Configuration.new.view_path).render(:partial => "pages/show", :locals => {:page => self}) Which allows me to render simple partials that don't user helpers, however if I try to user a link_to in my partial, i receive an error stating: undefined method `url_for' for nil:NilClass I've made sure that the object being passed into the "project_path(project)" is not nil. I've also tried including: include ActionView::Helpers::UrlHelper include ActionController::UrlWriter in the Module that contains the method that makes the above "render" call. Does anyone know how to work around this? Thanks

    Read the article

  • Design pattern to integrate Rails with a Comet server

    - by empire29
    I have a Ruby on Rails (2.3.5) application and an APE (Ajax Push Engine) server. When records are created within the Rails application, i need to push the new record out on applicable channels to the APE server. Records can be created in the rails app by the traditional path through the controller's create action, or it can be created by several event machines that are constantly monitoring various inputstream and creating records when they see data that meets a certain criteria. It seems to me that the best/right place to put the code that pushes the data out to the APE server (which in turn pushes it out to the clients) is in the Model's after_create hook (since not all record creations will flow through the controller's create action). The final caveat is I want to push a piece of formatted HTML out to the APE server (rather than a JSON representation of the data). The reason I want to do this is 1) I already have logic to produce the desired layout in existing partials 2) I don't want to create a javascript implementation of the partials (javascript that takes a JSON object and creates all the HTML around it for presentation). This would quickly become a maintenance nightmare. The problem with this is it would require "rendering" partials from within the Model (which im having trouble doing anyhow because they don't seem to have access to Helpers when they're rendered in this manner). Anyhow - Just wondering what the right way to go about organizing all of this is. Thanks

    Read the article

  • 302 Redirect to Images in IE8 do not render image

    - by empire29
    I am helping migrate a legacy application. One of the requirements is we are able to handle requests for old images. What we have is: New site on new.com Old site on old.com Images to links (imported content) point to /imgs/cat.png however the actual image is hosted on old.com/assets/images/cat.png (for now). <img src="/imgs/cat.png"/> I setup a redirect for all png, jpg, jpeg, gif that 302's requests for new.com/imgs/(.*).(png|jpg|jpeg|gif) to http://old.com/assets/images/$1.$2 Everything works find in Chrome, Firefox and IE9 - however it was noted in IE8 the image does not render. Its possible that it has the same issue in IE7, 6 and 5.5 however I have not been able to test this. Does anyone know why this is happening and how to fix? I tried setting the contentType header on the response of the 302's to image/(png|jpg|jpeg|gif) and this did not have any impact. Any insight would be appreciated.

    Read the article

1