RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

Cool tutorial Ryan! It would be nice to specify that it's applicable to version 0.8 though.

Avatar

This episode has been updated to Rails 5 as a blog post Thinking Sphinx in Rails 5

Avatar

This episode has been updated to Rails 5 as a blog post File Uploads using Paperclip in Rails 5

Avatar

This episode has been updated to Rails 5 as a blog post Going Back in Rails 5

Avatar

This episode has been updated to Rails 5 as a blog post Helpers Outside Views in Rails 5

Avatar

OMG, already 3 years gone but your this great articl still with so many visitors, great article and knowledge sharing, hi my friend, are you still on this great site for your advance tips sharing for us? I have a website which for sports shoes selling and there are some codes i could not understand, can you explain for me? :)
http://www.kicksvovo.com/

Avatar

HTTPBasicAuth is still the best way IMO to add quick authentication for things that don't need a full blown login system.

Avatar

The above link is wrong. Here is the correct link Tableless Model in Rails 5

Avatar

This episode has been updated to Rails 5 as a blog post Tableless Model in Rails 5

Avatar

Validation failed: Image could not download file: 301 Moved Permanently (Invalid Location URI)

this is my code

url = URI.extract(URI.encode((product.at_xpath('picture').text.strip)))[0]

  Product.create!(
    price: product.at_xpath('price').text,
    category_id: product.at_xpath('categoryId').text.gsub(cat_id, category),
    remote_image_url: uri,
    brand_id: product.at_xpath('vendor').text,
    title: product.at_xpath('name').text,
    description: product.at_xpath('description').text
  )

this url i am get
"http://trendsbrands.ru/upload/thumbs/%D0%A3%D0%A2000005993/e916578dfbf37f1d03c2f047dcedb986/middle.jpg"

any help or idea what going on

Avatar

This episode is updated to Rails 5 as a blog post Liquid Template in Rails 5

Avatar

I made use of the filter_sensitive_data option to replace a password in my cassette. This worked great the first time, but when I run the specs again, I get an error:

Failure/Error: VCR.use_cassette(cassette_name, record: :once) do
 URI::InvalidURIError:
   bad URI(is not URI?): https://<DOMAIN>:<PASSWORD>@services.yesmail.com:443/enterprise/composite/subscribeAndSend

Is there a way to deal with this problem?

Thanks for a great episode!
Louise

Avatar

This episode has been updated to Rails 5 as a blog post Semi Static Pages in Rails 5

Avatar

This episode has been updated to Rails 5 as a blog post Endless Page in Rails 5

Avatar

This episode has been updated to Rails 5 as a blog post Advanced Search Form in Rails 5

Avatar

You would provide different data set to test different search possibilities. For instance, provide keywords and check if it returns the expected products.

Avatar

hi there i m try too did you solve or find any way import product from large xml file if yes please let me share with thanks you can check my this link where i can import product form small file not from large file
http://stackoverflow.com/questions/36556532/how-to-import-20-thousand-product-from-large-xml-file-in-a-rails-app

Avatar

hi there i m try too did you solve or find any way import product from large xml file if yes please let me share with thanks you can check my this link where i can import product form small file not from large file
http://stackoverflow.com/questions/36556532/how-to-import-20-thousand-product-from-large-xml-file-in-a-rails-app

Avatar

This will also work.

ruby
def category_name=(name)
  self.category = Category.find_or_create_by(name: name) if name.present?
end
Avatar

I really like your article, the aspect of this guide is correct and very important for me. I own a online store which just need this kind of knowledge and I deside to update my site by the methords you told me, thank you my friend, If I have any questions in the future, I would like to back for your kind help, always welcome to my site if you can give me more suggestions.
http://www.kicksvovo.com/

Avatar

Hi Rayn,

I got one issues. pdf kit is support custom fonts. I tried one of project its not taking custom fonts'

here is example:

@font-face {
font-family: 'oswald_regularregular';
src: url(<%= "#{Rails.root}"+"/app/assets/fonts/oswald-regular.eot" %>);
src: url(<%= "#{Rails.root}"+"/app/assets/fonts/oswald-regular.eot?#iefix" %>) format('embedded-opentype'),
url(<%= "#{Rails.root}"+"/app/assets/fonts/oswald-regular.woff2" %>) format('woff2'),
url(<%= "#{Rails.root}"+"/app/assets/fonts/oswald-regular.woff" %>) format('woff'),
url(<%= "#{Rails.root}"+"/app/assets/fonts/oswald-regular.ttf" %>) format('truetype'),
url(<%= "#{Rails.root}"+"/app/assets/fonts/oswald-regular.svg#oswald_regularregular" %>) format('svg');
font-weight: normal;
font-style: normal;
}

Can you please help us

Avatar

This episode has been updated to Rails 5 as a blog post Dynamic Select Menus in Rails 5

Avatar

This episode has been updated to Rails 5 as a blog post Complex Forms in Rails 5.

Avatar

This episode has been updated to Rails 5 as a blog post Complex Forms in Rails 5.

Avatar

This episode has been updated to Rails 5 as a blog post Complex Forms in Rails 5.

Avatar

This episode has been updated to Rails 5 as a blog post Custom View Helpers in Rails 5

Avatar

This episode is updated for Rails 5 as a blog post Model Name in URL

Avatar

in the painting controller use the following:

def painting_params
  params.require(:painting).permit(:image)
end
Avatar

did u solve it i have same problem when i don't have any data it give me nil

Avatar

Thanks Ryan.
Seems to be uri changed by Pygments.

here is the new link
http://pygments.simplabs.com/
I tried with the above link and it works.

Avatar

I really liked this information, it was really useful for implementing this on a wall decal webshop of one of my customers http://www.muurplakkers.nl

Avatar

how i can upload product from XML file is there any advice or video thanks or some code thanks advance

Avatar

This episode has been updated for Rails 5 as a blog post. Handling Exceptions in Rails 5

Avatar

Wow! Bates, I always admired the quality of your videos and your work, this defines the personality and your dad seems to be a great person too!

Sincerely
Gabriel Francisco

Avatar

Testing would make sense if you had business logic. It does not make much sense for generating files.

Avatar

For anyone interested in diving deeper into scopes on associations in Rails, I've written up a post at http://ducktypelabs.com/using-scope-with-associations/

Defining scopes on your associations can come in handy for cleaning your code up and ensuring that business logic stays in one place. I was also motivated to write about it because there have been quite a few situations where I wanted to filter a group of records by given values of association records, for which scopes are useful.

Avatar

When i am running this command on rails 4:

rake mercury_engine:install:migrations

Then I am getting this exception:

rake aborted!
Don't know how to build task 'mercury_engine:install:migrations' (see --tasks)

Does anyone know how to solve it ?

Avatar

This episode has been updated for Rails 5 as a blog post. Update Through Checkboxes in Rails 5

Avatar

This episode has been updated for Rails 5 as a blog post. Will Paginate in Rails 5

Avatar

This episode has been updated for Rails 5 as a blog post. Console Tricks in Rails 5