Search Results

Search found 88 results on 4 pages for 'actionview'.

Page 3/4 | < Previous Page | 1 2 3 4  | Next Page >

  • How do I stub a view in rspec-2

    - by Trey Bean
    I'm in the process of upgrading an app to Rails 3/Rspec 2. I see that stubbing a view helper method has changed in Rspec 2. It looks like instead of doing template.stub!, we're now supposed to do view.stub!, but I can't seem to get this to work on beta 10. I get an "undefined local variable or method `view' for # < RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x106785fd0" error. I see that in this commit David removed the view method, but I can't figure out what it was replaced with. Something in ActionView::TestCase::Behavior? I'm on rails 3.0.0.beta3. Any idea what I'm missing?

    Read the article

  • I want actions not views.

    - by Ben
    Rails is doing my head in. I'm trying now to put something together to pull screen scraped data from site X through to client Y via a ruby script on server Z I don't want views, I just want the request to look like domain.com/action/method Inside routes.rb I have: match ':controller(/:action(/:id(.:format)))' But it still won't work. I just get ActionView::MissingTemplate in the log. Achtung! If I deliberately put a faulty method in that subsequently calls render - the log file indicates the method executed badly, so I don't think it's something wrong with the "action" controller.

    Read the article

  • How to render partial.js in rails 3

    - by julian-mann
    Using rails3 - I have a project with many tasks. I want to use javascript to build the UI for each task. I figured I could display those tasks on the projects show page by rendering a javascript partial for each. I can't get 'tasks/show' to see tasks/show.js.erb Any ideas? In projects/show.html.erb <div id="tasks"> <%= render(:partial => "tasks/show", :collection => @project.tasks) %> </div> tasks/show.js.erb $("tasks").append(new TaskWidget(task.id)) I get the errors ActionView::MissingTemplate in Projects#show Missing partial tasks/show with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths .... around line #13 Thanks

    Read the article

  • Ruby on rails link_to syntax

    - by mizipzor
    After following a tutorial Ive found. Im now redoing it again, without the scaffolding part, to learn it better. However, editing my \app\views\home\index.html.erb to contain: <h1>Rails test project</h1> <%= link_to "my blog", posts_path> I get an error: undefined local variable or method `posts_path' for #<ActionView::Base:0x4e1d954> Before I did this, I ran rake db:create, defined a migration class and ran rake db:migrate, everything without a problem. So the database should contain a posts table. But that link_to command cant seem to find posts_path. That variable (or is it even a function?) is probably defined through the scaffold routine. My question now is; how do I do that manually myself, define posts_path?

    Read the article

  • optional local variables in rails partial templates: how do I get out of the (defined? foo) mess?

    - by brahn
    I've been a bad kid and used the following syntax in my partial templates to set default values for local variables if a value wasn't explicitly defined in the :locals hash when rendering the partial -- <% foo = default_value unless (defined? foo) %> This seemed to work fine until recently, when (for no reason I could discern) non-passed variables started behaving as if they had been defined to nil (rather than undefined). As has been pointed by various helpful people on SO, http://api.rubyonrails.org/classes/ActionView/Base.html says not to use defined? foo and instead to use local_assigns.has_key? :foo I'm trying to amend my ways, but that means changing a lot of templates. Can/should I just charge ahead and make this change in all the templates? Is there any trickiness I need to watch for? How diligently do I need to test each one?

    Read the article

  • counter variable not working?

    - by jaycode
    Just like many things in rails, sometimes it works, sometimes it doesn't... Showing app/views/admin/products/_variant.html.erb where line #8 raised: undefined local variable or method `variant_counter' for #<ActionView::Base:0x107f7ae10> I only want to display variant_counter from partial _variant. This was the render caller code: <%= render :partial => '/admin/products/variant', :collection => product.variants %> The funny thing is, I have been using partial counter heaps number of times, somehow now I encountered this issue. Could anybody point me out what are there to find out what may went wrong?

    Read the article

  • Rails 4.2: "Assets should not be requested directly without their digests"

    - by Nowaker
    On Rails 4.2.0.beta1 I get an error: Assets should not be requested directly without their digests: Use the helpers in ActionView::Helpers to request fonts/source-sans-pro.woff The stylesheet: @font-face { font-family: 'Source Sans Pro'; font-style: normal; font-weight: 400; src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(/assets/source-sans-pro.woff) format('woff'); } The configuration is: config.serve_static_assets = true config.assets.js_compressor = :uglifier config.assets.compile = true config.assets.digest = true config.assets.version = '1.0' config.assets.paths << Rails.root.join('app', 'assets', 'fonts') config.assets.precompile += %w(.svg .eot .woff .ttf) Sure I can disable digests and it works again, but I'm interested in using them. Therefore, how do I make use of digests when I need to request source-sans-pro.woff? Please note that I place the fonts in assets/fonts directory, not the public/ directory. I don't see a difference between images and fonts, so I want to keep them under the same directory - app/assets.

    Read the article

  • Using Google Map Headers (YM4R) on Heroku

    - by Kevin
    I have the following at the top of my view: <%= GMap.header %> Heroku is giving me an ActionView::TemplateError on that line.... this works on my own machine but not on Heroku.... why is that? Is there something about Heroku that doesn't allow? In the final compile on the browser, the above code translates into this on the client side: <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=XXXXX;hl=&amp;sensor=false" type="text/javascript"> </script> <script src="/javascripts/ym4r-gm.js" type="text/javascript"></script>

    Read the article

  • Rails + Passenger CSS problem

    - by Dan
    I'm trying to deploy my first Rails app. At first, I was getting the following error: ActionView::TemplateError (Permission denied) I set the permissions of the stylesheets folder to 777 (just for now until I work out what's going wrong) and the application started to work. However, it is not picking up any of the stylesheets (everything is displayed in plain text). If I view the source code and click the CSS links, I just get a blank page. Javascripts however, seem to be working just fine. VHost Config: <VirtualHost *:80> ServerName xxxx.xxx.com DocumentRoot /home/myapp/public <Directory /home/myapp/public> Allow from All AllowOverride all Options -MultiViews </Directory> </VirtualHost> Can anyone help? Any advice appreciated. Thanks.

    Read the article

  • How good is the Rails sanitize() method?

    - by Horace Loeb
    Can I use ActionView::Helpers::SanitizeHelper#sanitize on user-entered text that I plan on showing to other users? E.g., will it properly handle all cases described on this site? Also, the documentation mentions: Please note that sanitizing user-provided text does not guarantee that the resulting markup is valid (conforming to a document type) or even well-formed. The output may still contain e.g. unescaped ’<’, ’’, ’&’ characters and confuse browsers. What's the best way to handle this? Pass the sanitized text through Hpricot before displaying?

    Read the article

  • Confused as to which Prototype helper to use

    - by user284194
    After reading http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html I just can't seem to find what I'm looking for. I have a simplistic model that deletes the oldest message after the list of messages reaches 24, the model is this simple: class Message < ActiveRecord::Base after_create :destroy_old_messages protected def destroy_old_messages messages = Message.all(:order => 'updated_at DESC') messages[24..-1].each {|p| p.destroy } if messages.size >= 24 end end There is a message form below the list of messages which is used to add new messages. I'm using Prototype/RJS to add new messages to the top of the list. create.rjs: page.insert_html :top, :messages, :partial => @message page[@message].visual_effect :grow #page[dom_id(@messages)].replace :partial => @message page[:message_form].reset My index.html.erb is very simple: <div id="messages"> <%= render :partial => @messages %> </div> <%= render :partial => "message_form" %> When new messages are added they appear just fine, but when the 24 message limit has been reached it just keeps adding messages and doesn't remove the old ones. Ideally I'd like them to fade out as the new ones are added, but they can just disappear. The commented line in create.rjs actually works, it removes the expired message but I lose the visual effect when adding a new message. Does anyone have a suggestion on how to accomplish adding and removing messages from this simple list with effects for both? Help would be greatly appreciated. Thanks for reading. P.S.: would periodically_call_remote be helpful in this situation?

    Read the article

  • Rspec stubing view for anonymous controller

    - by Colin G
    I'm trying to test a method on the application controller that will be used as a before filter. To do this I have setup an anonymous controller in my test with the before filter applied to ensure that it functions correctly. The test currently looks like this: describe ApplicationController do controller do before_filter :authenticated def index end end describe "user authenticated" do let(:session_id){"session_id"} let(:user){OpenStruct.new(:email => "[email protected]", :name => "Colin Gemmell")} before do request.cookies[:session_id] = session_id UserSession.stub!(:find).with(session_id).and_return(user) get :index end it { should assign_to(:user){user} } end end And the application controller is like this: class ApplicationController < ActionController::Base protect_from_forgery def authenticated @user = nil end end My problem is when ever I run the test I'm getting the following error 1) ApplicationController user authenticated Failure/Error: get :index ActionView::MissingTemplate: Missing template stub_resources/index with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml, :haml], :formats=>[:html], :locale=>[:en, :en]} in view paths "#<RSpec::Rails::ViewRendering::PathSetDelegatorResolver:0x984f310>" According to the docs the view is not rendered when running controller tests however this points to no stub existing for this action (which is understandable as the view doesn't exist) Anyone have a clue how to solve this problem or stub the view out. Cheers Colin G

    Read the article

  • Please help me work out this error, regarding the use of a HTTPService to connect Flex4 & Ruby on Ra

    - by ben
    I have a HTTPService in Flash Builder 4, that is defined as follows: <s:HTTPService id="getUserDetails" url="http://localhost:3000/users/getDetails" method="GET"/> It gets called as follows: getUserDetails.send({'user[username]': calleeInput.text}); Here is a screenshot of the network monitor, showing that the parameter is being sent correctly (it is 'kirsty'): Here is the Ruby on Rails method that it's connected to: def getDetails @user = User.find_by_username(:username) render :xml => @user end When I run it, I get the following error output in the console: Processing UsersController#list (for 127.0.0.1 at 2010-04-30 17:48:03) [GET] User Load (1.1ms) SELECT * FROM "users" Completed in 30ms (View: 16, DB: 1) | 200 OK [http://localhost/users/list] Processing UsersController#getDetails (for 127.0.0.1 at 2010-04-30 17:48:13) [GET] Parameters: {"user"={"username"="kirsty"}} User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."username" = '--- :username ') LIMIT 1 ActionView::MissingTemplate (Missing template users/getDetails.erb in view path app/views): app/controllers/users_controller.rb:36:in getDetails' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/local/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:95:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in each' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:23:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start' Rendering rescues/layout (internal_server_error) I'm not sure if the error is being caused by bad code in the getDetails Ruby on Rails method? I'm new to RoR, and I think I remember reading somewhere that every method should have a view. I'm just using this method to get info into the Flex 4 app, do I still need to make a view for it? Is that what's causing the error? Any help would be GREATLY appreciated, I've been stuck on this for a few days now! Thanks.

    Read the article

  • How do I so a select input for a STI column in a Rails model?

    - by James A. Rosen
    I have a model with single-table inheritance on the type column: class Pet < ActiveRecord::Base TYPES = [Dog, Cat, Hamster] validates_presence_of :name end I want to offer a <select> dropdown on the new and edit pages: <% form_for @model do |f| %> <%= f.label :name %> <%= f.text_input :name %> <%= f.label :type %> <%= f.select :type, Pet::TYPES.map { |t| [t.human_name, t.to_s] } %> <% end %> That gives me the following error: ActionView::TemplateError (wrong argument type String (expected Module)) I read a suggestion to use an alias for the field #type since Ruby considers that a reserved word that's the same as #class. I tried both class Pet < ActiveRecord::Base ... alias_attribute :klass, :type end and class Pet < ActiveRecord::Base ... def klass self.type end def klass=(k) self.type = k end end Neither worked. Any suggestions? Oddly, it works fine on my machine (MRI 1.8.6 on RVM), but fails on the staging server (MRI 1.8.7 not on RVM).

    Read the article

  • Does acts-as-taggable-on work on heroku?

    - by Martin
    Hello, I have a question: does the acts-as-taggable-on gem work on Heroku? I'been trying but it doesn't seem to work. In my development machine works okay. I'm wondering if it's maybe because Heroku uses PostgreSQL and my local env SQLite and for some reason postgresql is not supported by the special tagging "magic"? I couldn't find any related info to this, so I would like to know other experiences with this. I guess is pretty rare since both the gem and heroku are very popular. ActionView::Template::Error (undefined method `interests' for "#<About:0x2b35d6125728>":About): <% unless @user.about.interests.empty? %> <p><strong>interests and passions</strong><br /> <% @user.about.interests.each do |tag| %> <%= tag %>, <% end -%></p><% end %> In my about.rb model i have acts_as_taggable_on :interests, :music, :movies, :books, :tvs Thank you in advance!

    Read the article

  • Rails - Debugging Nested Routes

    - by stringo0
    Hi, I have 2 models, Assessments and Questions. Assessments have many questions. In routes, I have: map.resources :assessments, :has_many => :questions map.root :assessments I checked rake routes, it's as expected On the form to create a new question, I get the following error: undefined method `questions_path' for #<ActionView::Base:0x6d3cdb8> If I take out the form, the view loads fine, so I think it's something with the code in this view - I'm getting the error on the form_for line: <h1>New question</h1> <% form_for [@assessment, @question] do |f| %> <%= f.error_messages %> <p> <%= f.label :content %><br /> <%= f.text_field :content %> </p> <p> <%= f.submit 'Create' %> </p> <% end %> <%= link_to 'Cancel', assessment_path(@assessment) %> Link to rake routes, if needed - http://pastebin.com/LxjfmXQw Can anyone help me debug it? Thanks!

    Read the article

  • Skip HTML escape in custom label_tag helper in Rail 3

    - by tricote
    Hi, I have this nice class ErrorFormBuilder that allows me to add the error description near the corresponding field in the form view : class ErrorFormBuilder < ActionView::Helpers::FormBuilder #Adds error message directly inline to a form label #Accepts all the options normall passed to form.label as well as: # :hide_errors - true if you don't want errors displayed on this label # :additional_text - Will add additional text after the error message or after the label if no errors def label(method, text = nil, options = {}) #Check to see if text for this label has been supplied and humanize the field name if not. text = text || method.to_s.humanize #Get a reference to the model object object = @template.instance_variable_get("@#{@object_name}") #Make sure we have an object and we're not told to hide errors for this label unless object.nil? || options[:hide_errors] #Check if there are any errors for this field in the model errors = object.errors.on(method.to_sym) if errors #Generate the label using the text as well as the error message wrapped in a span with error class text += " <br/><span class=\"error\">#{errors.is_a?(Array) ? errors.first : errors}</span>" end end #Add any additional text that might be needed on the label text += " #{options[:additional_text]}" if options[:additional_text] #Finally hand off to super to deal with the display of the label super(method, text, options) end end But the HTML : text += " <br/><span class=\"error\">#{errors.is_a?(Array) ? errors.first : errors}</span>" is escaped by default in the view... I tried to add the {:escape = false} option : super(method, text, options.merge({:escape => false})) without success Is there any way to bypass this behavior ? Thanks

    Read the article

  • Trouble using termextraction ge

    - by mathee
    I'm trying to install this gem: http://github.com/alexrabarts/term_extraction. It required nokogiri, which I tried installing. I'm getting this as the output: >gem install nokogiri Successfully installed nokogiri-1.4.2.1-x86-mswin32 1 gem installed Installing ri documentation for nokogiri-1.4.2.1-x86-mswin32... No definition for parse_memory No definition for parse_file No definition for parse_with No definition for get_options No definition for set_options Installing RDoc documentation for nokogiri-1.4.2.1-x86-mswin32... No definition for parse_memory No definition for parse_file No definition for parse_with No definition for get_options No definition for set_options I was able to install the termextraction gem (per the README on git repo): >gem install alexrabarts-term_extraction -s http://gems.github.com Successfully installed alexrabarts-term_extraction-0.1.4 1 gem installed Installing ri documentation for alexrabarts-term_extraction-0.1.4... Installing RDoc documentation for alexrabarts-term_extraction-0.1.4... The issue is that I'm trying to test it out, but I'm getting an "uninitialized constant" error when I use it: ActionView::TemplateError (uninitialized constant ApplicationHelper::TermExtraction) on line #3 of app/views/questions/new. haml: 1: %h1 New question 2: -msg = "testing this context thing let's see what it gives me" 3: -getTerms(msg) 4: #new-question-form 5: .box-background 6: -form_for(@question) do |f| app/helpers/application_helper.rb:42:in `getTerms' app/views/questions/new.haml:3:in `_run_haml_app47views47questions47new46haml' haml (2.2.23) lib/haml/helpers/action_view_mods.rb:13:in `render' haml (2.2.23) lib/haml/helpers/action_view_mods.rb:13:in `render' app/controllers/questions_controller.rb:91:in `new' haml (2.2.23) lib/sass/plugin/rails.rb:20:in `process' Here is application_helper.rb: module ApplicationHelper def getTerms(context) yahoo = TermExtraction::Yahoo.new(:api_key => 'myAPIkey', :context => context) end end I'm not sure what the issue is. Any insight would be greatly appreciated!

    Read the article

  • RSpec: Can't convert Image to String when using Nested Resource.

    - by darrint
    I'm having trouble with and RSpec view test. I'm using nested resources and the model with a belongs_to association. Here's what I have so far: describe "/images/edit.html.erb" do include ImagesHelper before(:each) do @image_pool = stub_model(ImagePool, :new_record => false, :base_path => '/') assigns[:image] = @image = stub_model(Image, :new_record? => false, :source_name => "value for source_name", :image_pool => @image_pool) end it "renders the edit image form" do render response.should have_tag("form[action=#{image_path(@image)}][method=post]") do with_tag('input#image_source_name[name=?]', "image[source_name]") end end end The error I'm receiving: ActionView::TemplateError in '/images/edit.html.erb renders the edit image form' can't convert Image into String On line #3 of app/views/images/edit.html.erb 1: <h1>Editing image</h1> 2: 3: <% form_for(@image) do |f| %> 4: <%= f.error_messages %> 5: 6: <p> app/views/images/edit.html.erb:3 /opt/dtcm/railstest/lib/ruby/gems/1.9.1/gems/rspec-rails-1.3.2/lib/spec/rails/extensions/action_view/base.rb:27:in `render_with_mock_proxy' /opt/dtcm/railstest/lib/ruby/gems/1.9.1/gems/rspec-rails-1.3.2/lib/spec/rails/example/view_example_group.rb:170:in `render' Looking at the rails code where the exception occurs is not very revealing. Any ideas on how I can narrow down what is going on here? One thing I tried was calling form_for directly from the example and I got a different error griping about lack of 'polymorphic_path' defined on Spec::Rails::Example::ViewExampleGroup::Subclass_4:0xblah. Not sure if that actually means anything.

    Read the article

  • customized form_for tag in rails

    - by poseid
    I want to make a table within a form by making a new form_tag. The following code in ApplicationHelper fails: module ApplicationHelper class TabularFormBuilder < ActionView::Helpers::FormBuilder # ... code to insert <tr> tags </tr> end def tabular_form_for(name, object = nil, options = nil, &proc) concat("<table>", proc.binding) form_for(name, object, (options||{}).merge(:builder => TabularFormBuilder), &proc) concat("</table>", proc.binding) end end The view I use is: <h1>New project</h1> <% tabular_form_for :project, :builder => ApplicationHelper::TabularFormBuilder do |f| %> <%= f.error_messages %> <%= f.text_field :name %> <%= f.text_area :description %> <%= f.text_field :location %> <%= f.submit 'Create' %> <% end %> The error I get is: NoMethodError in Projects#new Showing app/views/projects/new.html.erb where line #5 raised: undefined method `errors' for {:builder=ApplicationHelper::TabularFormBuilder}:Hash Any ideas how to make this custom tag work?

    Read the article

  • Rails 3 shows 404 error instead of index.html (nginx + unicorn)

    - by Miko
    I have an index.html in public/ that should be loading by default but instead I get a 404 error when I try to access http://example.com/ The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved. This has something to do with nginx and unicorn which I am using to power Rails 3 When take unicorn out of the nginx configuration file, the problem goes away and index.html loads just fine. Here is my nginx configuration file: upstream unicorn { server unix:/tmp/.sock fail_timeout=0; } server { server_name example.com; root /www/example.com/current/public; index index.html; keepalive_timeout 5; location / { try_files $uri @unicorn; } location @unicorn { proxy_pass http://unicorn; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_redirect off; } } My config/routes.rb is pretty much empty: Advertise::Application.routes.draw do |map| resources :users end The index.html file is located in public/index.html and it loads fine if I request it directly: http://example.com/index.html To reiterate, when I remove all references to unicorn from the nginx conf, index.html loads without any problems, I have a hard time understanding why this occurs because nginx should be trying to load that file on its own by default. -- Here is the error stack from production.log: Started GET "/" for 68.107.80.21 at 2010-08-08 12:06:29 -0700 Processing by HomeController#index as HTML Completed in 1ms ActionView::MissingTemplate (Missing template home/index with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml, :haml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/www/example.com/releases/20100808170224/app/views", "/www/example.com/releases/20100808170224/vendor/plugins/paperclip/app/views", "/www/example.com/releases/20100808170224/vendor/plugins/haml/app/views"): /usr/local/rvm/gems/ruby-1.9.2-rc2/gems/actionpack-3.0.0.beta4/lib/action_view/paths.rb:14:in `find' /usr/local/rvm/gems/ruby-1.9.2-rc2/gems/actionpack-3.0.0.beta4/lib/action_view/lookup_context.rb:79:in `find' /usr/local/rvm/gems/ruby-1.9.2-rc2/gems/actionpack-3.0.0.beta4/lib/action_view/base.rb:186:in `find_template' /usr/local/rvm/gems/ruby-1.9.2-rc2/gems/actionpack-3.0.0.beta4/lib/action_view/render/rendering.rb:45:in `_determine_template' /usr/local/rvm/gems/ruby-1.9.2-rc2/gems/actionpack-3.0.0.beta4/lib/action_view/render/rendering.rb:23:in `render' /usr/local/rvm/gems/ruby-1.9.2-rc2/gems/haml-3.0.15/lib/haml/helpers/action_view_mods.rb:13:in `render_with_haml' etc... -- nginx error log for this virtualhost comes up empty: 2010/08/08 12:40:22 [info] 3118#0: *1 client 68.107.80.21 closed keepalive connection My guess is unicorn is intercepting the request to index.html before nginx gets to process it.

    Read the article

  • Rails 3 shows 404 error instead of index.html (nginx + unicorn)

    - by Miko
    I have an index.html in public/ that should be loading by default but instead I get a 404 error when I try to access http://example.com/ The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved. This has something to do with nginx and unicorn which I am using to power Rails 3 When take unicorn out of the nginx configuration file, the problem goes away and index.html loads just fine. Here is my nginx configuration file: upstream unicorn { server unix:/tmp/.sock fail_timeout=0; } server { server_name example.com; root /www/example.com/current/public; index index.html; keepalive_timeout 5; location / { try_files $uri @unicorn; } location @unicorn { proxy_pass http://unicorn; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_redirect off; } } My config/routes.rb is pretty much empty: Advertise::Application.routes.draw do |map| resources :users end The index.html file is located in public/index.html and it loads fine if I request it directly: http://example.com/index.html To reiterate, when I remove all references to unicorn from the nginx conf, index.html loads without any problems, I have a hard time understanding why this occurs because nginx should be trying to load that file on its own by default. -- Here is the error stack from production.log: Started GET "/" for 68.107.80.21 at 2010-08-08 12:06:29 -0700 Processing by HomeController#index as HTML Completed in 1ms ActionView::MissingTemplate (Missing template home/index with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml, :haml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/www/example.com/releases/20100808170224/app/views", "/www/example.com/releases/20100808170224/vendor/plugins/paperclip/app/views", "/www/example.com/releases/20100808170224/vendor/plugins/haml/app/views"): /usr/local/rvm/gems/ruby-1.9.2-rc2/gems/actionpack-3.0.0.beta4/lib/action_view/paths.rb:14:in `find' /usr/local/rvm/gems/ruby-1.9.2-rc2/gems/actionpack-3.0.0.beta4/lib/action_view/lookup_context.rb:79:in `find' /usr/local/rvm/gems/ruby-1.9.2-rc2/gems/actionpack-3.0.0.beta4/lib/action_view/base.rb:186:in `find_template' /usr/local/rvm/gems/ruby-1.9.2-rc2/gems/actionpack-3.0.0.beta4/lib/action_view/render/rendering.rb:45:in `_determine_template' /usr/local/rvm/gems/ruby-1.9.2-rc2/gems/actionpack-3.0.0.beta4/lib/action_view/render/rendering.rb:23:in `render' /usr/local/rvm/gems/ruby-1.9.2-rc2/gems/haml-3.0.15/lib/haml/helpers/action_view_mods.rb:13:in `render_with_haml' etc... -- nginx error log for this virtualhost comes up empty: 2010/08/08 12:40:22 [info] 3118#0: *1 client 68.107.80.21 closed keepalive connection My guess is unicorn is intercepting the request to index.html before nginx gets to process it.

    Read the article

  • Rails AtomFeedBuilder Entry :Url option appears in url tag but not in link tag

    - by Nick
    Hello, I'm using the AtomFeedHelper and everything is working fine except for one feed where I need to link each entry to a URL which is not the default polymorphic_url for the record. Per the documentation I've specified an :url option for the entry. This correctly renders a <url> tag in the atom node but the <link rel="alternate" still points to the default polymorphic_url. Looking at the source and the documentation I don't understand why this is happening. Here's an example builder: atom_feed do |feed| feed.title("Reports") feed.updated(@reports.first.created_at) for report in @reports content = report.notes feed.entry(report) do |entry| entry.title(report.title) entry.content(content, :type => 'html') entry.url("http://myhost/page/") entry.updated(report.updated_at.strftime("%Y-%m-%dT%H:%M:%SZ")) entry.author do |author| author.name(report.user.username) end end end end Here's an example of a problem node: <entry> <id>tag:molly.recargo.com,2005:SiteReport/2</id> <published>2010-03-30T13:11:07-07:00</published> <updated>2010-03-30T13:11:07-07:00</updated> <link rel="alternate" type="text/html" href="http://myhost/site_reports/2"/> <title>Test Title</title> <content type="html">Test Content</content> <url>http://myhost/page/</url> <updated>2010-03-30T13:11:07Z</updated> <author> <name>Author</name> </author> </entry> I wan the href value in the link tag to match the value in the url tag but it does not. When I look at the source listed for entry here http://api.rubyonrails.org/classes/ActionView/Helpers/AtomFeedHelper/AtomFeedBuilder.html I'd assume that this line would work correctly: @xml.link(:rel => 'alternate', :type => 'text/html', :href => options[:url] || @view.polymorphic_url(record)) Confused. Has anyone encountered this before? Thanks all!

    Read the article

  • Why aren't the :locals hash variables being passed in to a partial, when called from inside my rake

    - by marshally
    I need to render a bunch of painfully long running partials using a rake task. When I try to pull the partial from a rake task, I get the dreaded "Called id for nil, which would mistakenly be 4" error, which usually means that my locals hash has not been properly set into the partial. Here's the rake task (some variable names have been changed to protect the innocent): namespace :precache do desc "Precache stuff" task :precache => :environment do av = ActionView::Base.new(Rails::Configuration.new.view_path, {}) av.class_eval do include ApplicationHelper end @user = User.find(21) @rank = Rank.find(2) data = av.render(:partial => "reports/listing", :locals => {:user => @user, :rank => @rank}) end end And this is the error that I am getting: ** Execute precache:precache rake aborted! Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id On line #1 of app/views/reports/listing.html.erb 1: <%- @rid = @rank.id %> 2: <%- @cid = @user.id %> 3: <%- cache(:action => 'reports', :key => [arg1, arg2, arg3] ) do %> 4: <%- app/views/reports/_downline_js.html.erb:1 lib/tasks/precache_fragments.rake:12 rake (0.8.7) lib/rake.rb:636:in `call' rake (0.8.7) lib/rake.rb:636:in `execute' rake (0.8.7) lib/rake.rb:631:in `each' rake (0.8.7) lib/rake.rb:631:in `execute' rake (0.8.7) lib/rake.rb:597:in `invoke_with_call_chain' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' rake (0.8.7) lib/rake.rb:590:in `invoke_with_call_chain' rake (0.8.7) lib/rake.rb:583:in `invoke' rake (0.8.7) lib/rake.rb:2051:in `invoke_task' rake (0.8.7) lib/rake.rb:2029:in `top_level' rake (0.8.7) lib/rake.rb:2029:in `each' rake (0.8.7) lib/rake.rb:2029:in `top_level' rake (0.8.7) lib/rake.rb:2068:in `standard_exception_handling' rake (0.8.7) lib/rake.rb:2023:in `top_level' rake (0.8.7) lib/rake.rb:2001:in `run' rake (0.8.7) lib/rake.rb:2068:in `standard_exception_handling' rake (0.8.7) lib/rake.rb:1998:in `run' rake (0.8.7) bin/rake:31 /usr/bin/rake:19:in `load' /usr/bin/rake:19 details: I'm using Rails 2.3.5 and Ruby 1.8.7. Developing on Mac OSX. Eventually I will be deploying to Heroku.

    Read the article

< Previous Page | 1 2 3 4  | Next Page >