Hi i used the code in editresortbasic.html.erb
<% form_for @editresortbasic do %>
wizard controller.rb
Hi i used the code in editresortbasic.html.erb
<% form_for @editresortbasic do %>
wizard controller.rb
there are two main ways to create forms in RoR: - use the helpers that end with _tag, those create "pure" html tags and are not too much aware of objects contents (like @editresortbasic) - use it like that:
in the controllers edit action get @editresortbasic like:
def edit @resort_basic = ResortBasic.find(params[:id]) # this assumes, that the id of the ResortBasic to be edited is handed to this action end
then you can built your view like this:
<% form_for @resort_basic do |f| %> <%= f.text_field :name %> <% end %>
That way the form "knows" of the @resort_basic object and using the textfield that way, Rails knows that it's linked to this object and reads the value from @resort_basic.name Same for all the other fields in your form that are columns in the resort_basics table.
you can read many details about that in all RoR online tutorials, and you should (must) get comfortable with that kind of Rails syntax. There is not much sense in starting a project without knowing at least the basic syntax of the framework.
You are passing params[:id] as argument to find, so no need to use find_by_id. Its enough to use @resort_basic =ResortBasic.find(params[:id])
Hi
i used the same code but i got the error:
controller code: