Friday, April 20, 2012

[Rails] issues with changing directory structure in rails3

class BranchesController < ApplicationController
  def branch
    @branch = Branch.new (params[:branch])
    branch_back = @branch.branch
  end
end

 in the model have one branch.rb
 class Branch
    def branch
    end
 end

In the view have one branches folder, also have the branch.html.erb in that folder.
   <%= form_for(@branch) do |f| %>
   <%end%>

routes.rb

match 'branch'     => 'branches#branch'
resources :branches

i am getting this following error

NoMethodError in BranchesController#branch

You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.each
What am I doing wrong?
Thank you
vishnu



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/anCewQjZXw8J.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate