Commit a202e947
Changed files (4)
app
models
views
tutorials
app/models/tutorial.rb
@@ -1,4 +1,4 @@
class Tutorial < ActiveRecord::Base
- attr_accessible :description, :heading, :url
+ attr_accessible :description, :heading, :url, :image_url
belongs_to :user
end
app/views/tutorials/_form.html.erb
@@ -11,7 +11,7 @@ $(function(){
$('a.embed-url').text(data.title);
$('a.embed-provider').attr('href', data.provider_url);
$('a.embed-provider').text(data.provider_name);
- console.log(data);
+ $('#tutorial_image_url').val(data.thumbnail_url);
});
});
});
@@ -39,6 +39,7 @@ $(function(){
</div>
</div>
<div class="form-actions">
+ <%= f.hidden_field :image_url %>
<button type="submit" class="btn btn-primary">Save changes</button>
<a href="<%= url_for tutorials_url %>" class="btn">Cancel</a>
</div>
db/migrate/20120913024022_add_image_url_to_tutorial.rb
@@ -0,0 +1,5 @@
+class AddImageUrlToTutorial < ActiveRecord::Migration
+ def change
+ add_column :tutorials, :image_url, :string
+ end
+end
db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120906132947) do
+ActiveRecord::Schema.define(:version => 20120913024022) do
create_table "active_admin_comments", :force => true do |t|
t.integer "resource_id", :null => false
@@ -120,6 +120,7 @@ ActiveRecord::Schema.define(:version => 20120906132947) do
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.string "image_url"
end
create_table "users", :force => true do |t|