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
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
No, have a look at the Rails Guide on Action Controller Overview to
see how to use it. Also google for
rails before_filter
to find many examples and documentation.
Colin
>
>
>>
>> Use before_filter to setup @name for both create and branch.
>>
>> Colin
>
> --
> 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/-/TfDKhbzW_zkJ.
>
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-ta...@googlegroups.com.
Colin
>
>
>>
>> Use before_filter to setup @name for both create and branch.
>>
>> Colin
>
> --
> 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/-/TfDKhbzW_zkJ.
>
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
Show us what you tried and what happened.
Colin
Just use a simple before_filter initially to get it working.
Colin
class BranchesController < ApplicationControllerbefore_filter :create
def branch
@branch = Branch.new
end
def create
@branch = Branch.new(params[:branch])
@name = "vishnu"
end
end
Colin