Last active
January 4, 2016 07:59
-
-
Save elliotec/8592785 to your computer and use it in GitHub Desktop.
not printing number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p id="notice"><%= notice %></p> | |
<p> | |
<strong>Name:</strong> | |
<%= @list.name %> | |
</p> | |
<% @list.steps.each do |s| %> | |
<%= s.number %><br/> | |
<%= s.text %><br/> | |
<% end %> | |
<%= link_to 'Edit', edit_list_path(@list) %> | | |
<%= link_to 'Back', lists_path %> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
# This file is auto-generated from the current state of the database. Instead | |
# of editing this file, please use the migrations feature of Active Record to | |
# incrementally modify your database, and then regenerate this schema definition. | |
# | |
# Note that this schema.rb definition is the authoritative source for your | |
# database schema. If you need to create the application database on another | |
# system, you should be using db:schema:load, not running all the migrations | |
# from scratch. The latter is a flawed and unsustainable approach (the more migrations | |
# you'll amass, the slower it'll run and the greater likelihood for issues). | |
# | |
# It's strongly recommended that you check this file into your version control system. | |
ActiveRecord::Schema.define(version: 20140124005517) do | |
create_table "lists", force: true do |t| | |
t.string "name" | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
end | |
create_table "steps", force: true do |t| | |
t.string "text" | |
t.integer "number" | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
t.integer "list_id" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StepsController < ApplicationController | |
before_action :set_step, only: [:show, :edit, :update, :destroy] | |
before_action :list | |
def show | |
end | |
def new | |
@step = Step.new | |
end | |
def edit | |
end | |
def create | |
@step = Step.new(step_params) | |
end | |
def update | |
if @step.update(step_params) | |
redirect_to lists_index_path | |
end | |
end | |
def destroy | |
@step.destroy | |
end | |
end | |
private | |
def set_step | |
@step = Step.find(params[:id]) | |
end | |
# Never trust parameters from the scary internet, only allow the white list through. | |
def step_params | |
params.require(:step).permit(:text, :number) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can't see your controller stuff to properly diagnose why s.number won't show up but the above should help you get around that.