Skip to content

Commit

Permalink
Steps will display in the correct order now
Browse files Browse the repository at this point in the history
  • Loading branch information
rhuberdeau committed Oct 14, 2011
1 parent c2286b8 commit 50d1f99
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/tutorials_controller.rb
Expand Up @@ -15,7 +15,7 @@ def index
# GET /tutorials/1.xml
def show
@tutorial = Tutorial.find_by_permalink(params[:id])
@steps = @tutorial.steps.order("position")
@steps = @tutorial.steps
@next = @steps[0]
@title = "#{@tutorial.name} - A Ruby on Rails tutorial"
respond_to do |format|
Expand Down
5 changes: 1 addition & 4 deletions app/models/step.rb
Expand Up @@ -9,9 +9,6 @@ class Step < ActiveRecord::Base
private

def assign_position
@tutorial = self.tutorial
@position = @tutorial.steps.size
@position = @position + 1
self.position = @position
self.position = tutorial.steps.size + 1
end
end
2 changes: 1 addition & 1 deletion app/models/tutorial.rb
@@ -1,6 +1,6 @@
class Tutorial < ActiveRecord::Base
attr_accessible :name, :summary, :permalink
has_many :steps
has_many :steps, :order => 'id'

validates :name, :presence => true,
:length => { :maximum => 50 },
Expand Down
3 changes: 2 additions & 1 deletion app/views/tutorials/show.html.erb
Expand Up @@ -25,6 +25,7 @@
<!--This is filled with the forward and backward links by jquery -->
</div>
<div id="slidesContainer">
<%= render :partial => @tutorial.steps %>
<%= render @steps %>

</div>
</div>

0 comments on commit 50d1f99

Please sign in to comment.