RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

There's a lot of interesting info here! I'm very grateful for the post! movers and packers hyderabad , is here to make your life simpler.
Homepage : packersmovershyderabadcity.in/ ,
Blog : Blog.packersmovershyderabadcity.in ,
Packers And Movers is recognized as a business manager providing wide-ranging and differentiate service appearance as well as Relocation Shifting, Logistics and Transportation, Facilities managing, strategy & Designing services.

Avatar

You can just manually send the Airbrake using Airbrake.notify_or_ignore(...)

Avatar

Hi did you discover the answer to this question? I wanted to ask it as well!?

Avatar

This is one of my favorite topic which I always want to learn more and more. Good to see this much interesting article and i delighted so much to know more facts about this.

Avatar

How can i upload big file to S3 with resumable.js in rails plz give some example..
Thanks

Avatar

How can i enhance this code to Resumable Upload like youtube. This code is getting failed when the internet getting disconnect..
Plz give some suggestion..
Thanks!

Avatar

How i can get error messages when validation fails. Please someone help me to fix this. Any help will be appreciated. Thanks

Avatar

Get the latest coupons codes, promo codes, deals, printable coupons for thousands of stores on couponbirds such as lane bryant coupon, hsn coupon code and gymboree coupon.

Avatar

Soothe out your ongoing economic hassles by availing Text Loans which have an online basis and are easily available from the lender’s website. A quick relief from the plight will be possible once you choose the desired aid to be derived from the website, without charges to be paid.

Avatar

In this part of the code

var states = new Array();
<% for state in @states %>
states.push(new Array(<%= state.country_id %>, '<%=h state.name %>', <%= state.id %>));
<% end %>

Exactly in the for, I am having this error: undefined method `each' for nil:NilClass

Avatar

Ok guys for those using Rails 4 and up:

go to this file: filter_parameter_logging.rb in config/initializers folder:

You will notice that this is already in there: Rails.application.config.filter_parameters += [:password]

that means all parameters with the word "password" in it will be filtered out. But you are not safe yet! You also need to ensure that you are not logging the sql entries. In order to check that you need to ensure that in:

config/environments/production.rb

there is a line like this:

config.log_level = :info

make sure that the log_level is anything BUT NOT :debug.

and then you are more protected. I would suggest in the production environment to have something above :info. Info is a little too insecure in my opinion.

I hope this post helps someone!

Ben

Avatar

Hi, very helpful! I have this error:
undefined method read_attribute_for_serialization

What is? Thanks

Avatar

Is there a way of autoselecting (via Ajax let's say for example) similar associations? if you have examples please do share.

Avatar

Can you go into a bit more detail? What does your ProductCollection model and controller look like? How about your routes?

Avatar

ArgumentError in ProductsController#discontinue
wrong number of arguments (2 for 1)

I'm getting an error here. anybody know how to fix that. It happens in the products controller, in the discontinue action (which we custom created), on this line:

Product.update_all({discontinued: true}, {id: params[:product_ids]})

Avatar

Railsapi.org was using new Rails Logo which was announced in 2015! see at 5:36

Avatar

Instead of listing users one by one can't use dropdown list ?

Avatar

Hi,
It is very usefull if i know, How to set highlight in elasticsearch?

Avatar

This episode covering tagging from scratch has been upgraded to Rails 5. Checkout Tagging from Scratch in Rails 5

Avatar

Hi folks

what if in the form we are setting remote = true then none of this will work because we are using ajax and preventing the form from refreshing? If you have any idea please hit the reply button.

with thx

Ben

Avatar

I think my hands are growing from an incorrect place as I don't get how you guys doing it. I have nothing but mistakes there.((

Avatar

hi guys :)
how create a search form for dynamic form ??

Avatar

I know this is a pretty old thread, but I had a question about updating inputted files. I'm at the point where I can get files (only working with CSV right now) to update (adding new entries and updating existing ones) but I've noticed that deleting entries from the CSV file does not delete from the database. Would I have to write code to check each entry in the database with each on in the CSV?

Avatar

Just a correction in order to rewrite the ID as well:

var $new_obj = $('<fieldset></fieldset>').html($content_item.find('fieldset:first').html()
  .replace(new RegExp(name + '_0', "g"), name + '_' + number).replace(/\[0\]/g, '\[' + number + '\]'));
Avatar

I use a different approach:

// application.js
$('form').on('click', '.add-fields', function(e) {
    var $content_item = $(this).closest('.content-item');
    var number = $content_item.find('fieldset').length;
    var name = $(this).data('name');
    var $new_obj = $('<fieldset></fieldset>').html($content_item.find('fieldset:first').html().replace(/\[0\]/g, '\[' + number + '\]'));
    $(this).before($new_obj);
    $new_obj.find(':input').not(':hidden, :checkbox, :radio').val('');
    $new_obj.find(':checkbox, :radio').prop('checked', false);
    e.preventDefault();
});

# _form.html.erb
<%= link_to 'Add', '#', class: "add-fields", data: {name: :person_cars_attributes} %>

This way I don't need any helper_method.

Avatar

Old I know, but I'm actually wanting to do this too. Did you ever get this figured out?

Avatar

I've also downloaded the "before" example from Ryan's github page and am trying to work towards the "final" result when i click the new link it redirects to the new page as opposed to letting JQuery do its magic. Does any body have any suggestions?

Avatar

How to Import Image from excel file to Rails data base?
in excel file i store image(not Url).
like i have 2 column
Name Profile_pic
xyz Image of user

pls reply fast

Avatar

For some reason, my complete action keeps going into the update action of my controller. Why is this behavior happening, and what can I do to fix it?

Avatar

Hey Bala

Suppose each person has the following attributes: country, state and name.

Do you know how one can create 10 people, all from the same Country and State, in the same form................at the moment using your solution and Ryan Bates' i would have to Reselect the same country and state 10 times. The only thing that is different between all 10 people are their names.

Any advice much appreciated.

rgds

Ben

Avatar

Hi. will this "Importing CSV and Excel source code" work on ruby version 1.8.7 and rails 3.0.10?

Avatar

This article has been updated to Rails 5 as a blog post Using Ajax and jQuery in Rails 5 Apps

Avatar

This is now outdated video. I am getting a lot of errors.
e.g undefined method `original_filename' for nil:NilClass.

It needs to be updated.

Avatar

Does anybody know what the difference between find_by and find_by_all is?

Avatar

I had problems using Rails 5. respond_to and respond_with have been moved into the responders gem. After adding that to my Gemfile, I got the expected JSON at http://localhost:3000/api/entries.json.

Avatar

HI folks

do you know if there is a datatable which allows you to see child rows (collapsible) and which has CRUD links - like with scaffolding? I could really use one such table like that right now ;)

chrs

Ben

Avatar

This episode has been updated to Rails 5 as a blog post Supporting Guest Users in Rails 5 App

Avatar

Hi folks

was hoping for some advice:

My nested form is starting to become increasingly large and complex. I would like to collapse certain things. Is this possible?

Also is it possible to view only certain children via a drop down menu? any advice much appreciated.
rgds
Ben

Avatar

it was way too fast for me :'(

Avatar

In Rails 4.x, you can use has_secure_password to simplify the implementation. Checkout these articles, Authentication from Scratch : Register Feature and Login and Logout

Avatar

after issuing taps server sqlite://db/development.sqlite3 mahesh secret command i got below error? how to rectify it?
Error:-`module:Templates': uninitialized constant Tilt::CompileSite (NameError)Did you mean? Complex

Avatar

Hello Dan,

I had bookmarked that link some time ago but your website appears to be down.

Is there a replacement site where your content is hosted? It is a great article and I'm sure those of us who read it found it useful.

Thank you much.

Avatar

Unfortunately, Dan's site seems to be down. I sure do wish I'd saved his post as a PDF or something, it's brilliantly written and simple.

Avatar

Wondering what version of rails was this railscast written for? I'm a newbie trying to learn using 4.2.6, there seem to be a lot of issues with all the railscasts I've tried. I can't see where they specify the rails version they were written for.