asciicasts.com Archives - 28 January 2013, Monday

  • “Episode 396 - Importing CSV and Excel”

    asciicasts.com 02 Jan '13, 1am

    In episode 362 we showed how to export database records to a CSV or Excel file. Since then there have been a number of requests for an episode showing how to import records from these types of files so that’s what we’ll cover in this episode. We’ll do this by adding a form to the bott...

  • “Episode 217 - Multistep Forms”

    asciicasts.com 30 Dec '12, 5pm

    A good multistep form remembers the input between steps, allowing users to go backwards and forwards through the pages without losing any of the information they have entered. If you just want to break up a big form to simplify the user interface you may could use a combination of Jav...

  • “Episode 154 - Polymorphic Association”

    asciicasts.com 24 Nov '12, 5am

    Above is a page from a site that has three different models: articles, photos and events. We’d like to enhance the site so that its users can add comments to an article, a photograph or an event. If we were just adding comments to one of the models, say articles we’d create a Comment ...

  • “Episode 288 - Billing With Stripe”

    asciicasts.com 24 Nov '12, 2am

    Stripe needs two API keys so that it knows which account it’s working with. We’ll store these in a new stripe.rb initializer file in the application’s /config/initializers directory. The keys we need to store here are the secret test key that’s shown in our account page and the public...

  • ASCIIcasts - “Episode 196 - Nested Model Form Part 1” #dev

    “Episode 196 - Nested Model Form Part 1”

    asciicasts.com 13 Nov '12, 12pm

    models we’ll move on to the survey form. What we want to do here is add fields for each of the survey’s questions to the form. We can use the fields_for method to manage associated fields in a form, passing it the name of the associated model and then loop through all of the associate...

  • “Episode 192 - Authorization with CanCan”

    asciicasts.com 29 Jul '12, 6am

    we covered Declarative Authorization . While it is an excellent authorization plugin for Rails it can be a little heavy for simpler sites. After writing the Railscast on Declarative Authorization Ryan Bates looked for an alternative solution and, failing to find one that suited his ne...

  • “Episode 257 - Request Specs and Capybara”

    asciicasts.com 26 Jul '12, 12am

    If we run the specs now we’ll have two passing specs, so it looks like our code works as expected. If we were doing test-driven development we’d start with a failing spec and then write code to make it pass and this is one of the advantages of test-driven development as it ensures tha...

  • @johnbarton writing an interceptor for this case is pretty trivial.

    “Episode 206 - Action Mailer in Rails 3”

    asciicasts.com 02 Jul '12, 6am

    Next we need to write the code that will deliver the email when the user is created. Some people like to use a Model Observer to do this, but we’re going to keep the code in the controller layer. The reason for doing it this way is that if we do use an observer and then create User ob...

  • “Episode 26 - Hackers Love Mass Assignment”

    asciicasts.com 28 Jun '12, 3am

    26: Hackers Love Mass Assignment (view original Railscast) Other translations: Other formats: Mass assignment is something most Rails programmers make use of as it provides an easy way to populate the properties of a model object from a form. Unfortunately its simplicity can make it a...

  • Recent Episodes

    asciicasts.com 23 Jun '12, 2pm

    330 Better SASS With Bourbon If you are tired of the browser vendor prefixes in CSS, take a look at Bourbon. It provides Sass mixins and functions to make CSS more convenient. Tags: plugins views 328 Twitter Bootstrap Basics Twitter Bootstrap can help make beautiful web apps quickly b...

    Related:
    1. Recent Episodes asciicasts.com 13 Jun '12, 6pm
  • Recent Episodes

    asciicasts.com 13 Jun '12, 6pm

    292 Virtual Machines with Vagrant Vagrant allows you to run your Rails application and all of its dependencies in a portable, sharable environment. Use for development, set it up as a staging server, or experiment with a production setup. Tags: tools 290 SOAP With Savon Communicating ...

    Related:
    1. video.to_s asciicasts.com 12 Jun '12, 8pm
    2. Recent Episodes asciicasts.com 23 Jun '12, 2pm
  • video.to_s

    asciicasts.com 12 Jun '12, 8pm

    I really like Ryan Bates’s Railscasts , but videos aren’t the easiest thing to search through when you’re trying to search for a single tip or line of Ruby code to add to your own site. ASCIIcasts are text versions of each Railscast, each with a link to the original video. I hope you ...

    Related:
    1. Recent Episodes asciicasts.com 13 Jun '12, 6pm
  • 324 - Passing Data to JavaScript”

    asciicasts.com 05 Jun '12, 8am

    When JavaScript plays a large part in a Rails application it often becomes necessary to pass data from the app on the server to JavaScript to be used by the client. In this episode we’ll explore some techniques for doing just that. Below is a simple page from a simple Rails applicatio...

  • 215 - Advanced Queries in Rails 3”

    asciicasts.com 22 May '12, 8pm

    215: Advanced Queries in Rails 3 (view original Railscast) Other translations: Other formats: This episode will cover advanced queries in Rails 3. In episode 202 [watch , read ] we covered the additions to ActiveRecord queries in Rails 3; here we’ll carry on from there and show you so...

  • ASCIIcasts - “Episode 235 - OmniAuth Part 1”:

    235 - OmniAuth Part 1”

    asciicasts.com 28 Apr '12, 11pm

    There’s a great article on the Rails Rumble blog that explains in detail how to add OmniAuth to a Rails application. The article shows you how to create authentication from scratch, but here we’ll show you how to integrate OmniAuth into an application with an existing authentication s...

  • ASCIIcasts - “Episode 236 - OmniAuth Part 2”:

    236 - OmniAuth Part 2”

    asciicasts.com 28 Apr '12, 11pm

    Unfortunately there is no easy solution to this problem. What we’ll do is keep the validation and redirect the user to a form where they can fix any problems if the validation fails when we try to save the new user. We’ll change the code in create so that if the validation fails when ...

  • ASCIIcasts - “Episode 176 - Searchlogic”:

    176 - Searchlogic”

    asciicasts.com 27 Apr '12, 10am

    . This works by creating a number of named scopes that can be called on any ActiveRecord model to search against that model’s attributes. Given, say, a User model with a username attribute, Searchlogic lets us use methods such as username_equals , username_does_not_equal , username_be...

    Related:
    1. 219 - Active Model” asciicasts.com 26 Apr '12, 12pm
  • 219 - Active Model”

    asciicasts.com 26 Apr '12, 12pm

    Episode 193 [watch , read ] was all about tableless models. In that episode we created a model that used some of ActiveRecord’s features but which didn’t have a database table behind it. The technique we used was quite a hack as this is something that ActiveRecord wasn’t designed to d...

    Related:
    1. 176 - Searchlogic” asciicasts.com 27 Apr '12, 10am
  • 241 - Simple OmniAuth”

    asciicasts.com 22 Apr '12, 8pm

    A few weeks ago episodes 235 [watch , read ] and 236 [watch , read ] covered OmniAuth. OmniAuth provides a great way to integrate third-party authentication services such as Twitter and Facebook into your Rails applications. The scenario we presented in those episodes was rather compl...

  • ASCIIcasts - “Episode 153 - PDFs With Prawn”:

    153 - PDFs With Prawn”

    asciicasts.com 16 Apr '12, 9pm

    showed how to generate PDFs with the PDF::Writer gem. That is still a good way to generate PDF files, but there is now a much newer gem called Prawn available and all the cool kids are using that. Prawn is a very fast Ruby PDF generator that is installed as as gem, but it isn’t specif...

  • ASCIIcasts - “Episode 189 - Embedded Association”:

    189 - Embedded Association”

    asciicasts.com 13 Apr '12, 12pm

    In the previous episode we created a role-based authentication system. On the application’s sign-up page a series of checkboxes allowed a user to assign themselves to one or more roles. The application has a Role model in which the roles are defined and a many-to-many relationship bet...

  • Deadweight looks perfect for this: Github: https://t.co/4eDM1onp Railscasts: ASCIIcasts:

    180 - Finding Unused CSS”

    asciicasts.com 22 Mar '12, 3pm

    Any medium or large-sized website probably has a large amount of CSS spread across one or more stylesheets and the chances are that there are selectors in those stylesheets that are no longer used on any of the pages in that site. These selectors should be removed but they rarely are ...

    Related:
    1. #334 Compass & CSS Sprites railscasts.com 22 Mar '12, 5am
  • ASCIIcasts - “Episode 160 - Authlogic”:

    ASCIIcasts - “Episode 160 - Authlogic”

    asciicasts.com 20 Mar '12, 6pm

    . It uses a different approach from Restful Authentication in that it doesn’t generate controllers or views but just deals with the code to handle the authentication for your users. Because of that it can take a bit longer to get your application running under Authlogic, as you have t...

  • ASCIIcasts - “Episode 151 - Rack Middleware”

    asciicasts.com 19 Mar '12, 9pm

    To demonstrate Rack Middleware we’re going to use the simple e-commerce application seen in previous episodes. We’d like to know how long each request takes to process so we’re going to use Middleware to inject an HTML comment into each page that contains the processing time. This is ...

  • ASCIIcasts - “Episode 224 - Controllers in Rails 3”

    asciicasts.com 13 Mar '12, 8pm

    This line is added by default in a new Rails 3 application. It’s easy to forget to add filtering into an application so it’s a nice feature to have installed by default. It will of course only filter password parameters as it stands and will need to be altered if other parameters such...

  • ASCIIcasts - “Episode 330 - Better SASS With Bourbon”

    asciicasts.com 12 Mar '12, 3am

    To use Bourbon with Rails’ asset pipeline we’ll need to change the way that the default application.css file works. By default this file will use a Sprockets manifest to load each of the other stylesheet assets. The problem with this is that Sprockets compiles each SASS file into CSS ...

  • ASCIIcasts - “Episode 135 - Making a Gem”:

    ASCIIcasts - “Episode 135 - Making a Gem”

    asciicasts.com 27 Feb '12, 1am

    Back in episode 33 [ watch , read ], we made a plugin for Rails. A more popular option for extending Rails’ functionality now is to make a gem, and that’s what we’re going to do in this episode. Let’s say that we’d like to be able to generate a unique token for an ActiveRecord model. ...

    Related:
    1. memcached rubygems.org 26 Feb '12, 8pm
    2. kendoui-rails rubygems.org 28 Feb '12, 2am