On 21 April 2012 09:14, amvis <[email protected]> wrote: > ... > what i am trying to do, > > branches_controller > > class BranchesController < ApplicationController > def branch > @branch = Branch.new > end > > def create > @branch = Branch.new(params[:branch]) > @name = "vishnu" > end > end > > branch.html.erb > <h4> new <%=@name %> </h4> > <%= form_for(@branch) do |f| %> > <%= f.submit "Save" %> > <%end%> > > if i have to get @name in branch.html.erb, i have to define that branch > action in BranchesController, am i correct...?. So in this application all > the main function done in create action in BranchesController. In that way > how to get that values in branch.html.erb
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 post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

