Here’s one way to do it:
- Set up the
model_spec.rbfile first. We’re going to use recipes and users for an example - Add associations to the models recipe.rb and user.rb
- Create the migration and apply it.
Here’s one way to do it:
model_spec.rb file first. We’re going to use recipes and users for an exampleDevise is pretty spiffy, what with handling authentication 1-2-3. However, you still need to handle the users, and this code kata is exactly what you need.
The kata looks about like this:
session.featuresession_steps.rbresources :users (or resources :members or whatever) to config/routes.rb.Here are some small snippets of code for your Rails social media button pleasure:
First, the haml template:
%ul.cf.social_links
%li#twitter
%a{:href => "http://twitter.com/home?status=Check%20out%20the%20Portfolio%20Project%20-%20#{request.url}"}
= image_tag('twitter.png', :alt => 'Share this on twitter', :title => 'Share this on twitter')
%li#facebook
%a{:href => "http://www.facebook.com/sharer.php?u=#{request.url}&t=PortfolioProject", :target => "blank"}
= image_tag('facebook.png', :alt => "Share this on facebook", :title => "Share this on facebook")
%li#linkedin
%a{:href => "http://www.linkedin.com/shareArticle?mini=true&url=#{request.url}&title=Check%20out%20Portfolio-Project.com&source=#{request.url}"}
= image_tag('linkedin.png', :alt => "Share this on linkedin", :title => "Share this on linkedin")
%li#gplus
.g-plusone{"data-count" => "false", "data-size" => "small"}