Commit d754e186

mo k <mo@mokhan.ca>
2013-02-21 03:51:04
make sure proper tutorial_tags element is passed to the controller.
1 parent a97c035
Changed files (2)
app
models
views
app/models/tutorial.rb
@@ -1,5 +1,6 @@
 class Tutorial < ActiveRecord::Base
   attr_accessible :description, :heading, :url, :image_url, :user_id, :author, :author_url
+  validates :url,  :presence => true
   belongs_to :user
   acts_as_taggable
 
app/views/tutorials/_form.html.erb
@@ -20,7 +20,7 @@ $(function(){
       </div>
       <div class="control-group">
         <label for="tags" class="control-label">Tags</label>
-        <input type="text" id="tags" value="" class="input-xxlarge" autocomplete="off" />
+        <input type="text" id="tags" name="tutorial_tags" value="" class="input-xxlarge" autocomplete="off" />
       </div>
       <div class="form-actions">
         <%= f.hidden_field :heading, :class => "input-xlarge, tutorial-heading" %>
@@ -28,7 +28,6 @@ $(function(){
         <%= f.hidden_field :author_url, :class => "input-xlarge, tutorial-author-url" %>
         <%= f.hidden_field :description, :class => "input-xlarge, tutorial-description" %>
         <%= f.hidden_field :image_url %>
-        <input type="hidden" name="tutorial_tags" id="hidden_tags" />
         <button type="submit" class="btn btn-primary">Save changes</button>
         <a href="<%= url_for tutorials_url %>" class="btn">Cancel</a>
       </div>