[Solved] Format a string containing Phone numbers

This will take care of 0‘s in between the phone numbers phone=”08763843478,+918763843478,08763843478,+918763843478,+918763840008″ phone.split(‘,’).map{|num| num.gsub(/^\+91|^0/, ”)}.join(‘,’) #=> “8763843478,8763843478,8763843478,8763843478,8763840008” 0 solved Format a string containing Phone numbers

[Solved] Cant reach to the next form ‘RoR 3+’

Try changing this new_student_student_previous_datum_path(@student) to new_student_student_previous_datum_path(student_id: @student.id) if it still throws the error, paste me the complete routing error. UPDATE: the error is in the view this url for the form currently is This one is generating the error of the :action : “show” change it for new_student_student_previous_datum_path(@student) <%= bootstrap_form_for(@student_previous_data, :url => new_student_student_previous_datum_path(@student), html: { … Read more

[Solved] jQuery Validate plugin : Only one field required out of multiple [closed]

1) As per the question you’ve linked, I constructed this jsFiddle using the depends option and still see lots of issues. The rules do not seem to work at all, where both fields are always required. 2) There is a require_from_group rule included in the additional-methods.js file. The two fields must have the same class … Read more

[Solved] How to do recurring deposit calculations accurately [closed]

If the first month calculation is correct and subsequent months are wrong, are you saying that you want a compound interest formula? (i.e. in month 2 you calculate interest on principle + previous months’ interest) toal = deposit_amount * (rate_of_interest*30/365)**month_number 1 solved How to do recurring deposit calculations accurately [closed]

[Solved] form_for [@parent, @child] causes undefined method `parent_child_path’ in Child#new

The thing about form_for is that its URL is based on the model that you passed in. In your case, it’s: <%= form_for [@user, @college] do |f| %> Rails automatically looks for user_college_profiles_path because you assigned User to @user, and current_user.college_profile to @college. Fortunately, Rails provides a way to override the default URL the form … Read more

[Solved] Why does my Rails app think I’m CSRF?

Your problem is in the User model: before_save :create_remember_token def create_remember_token self.remember_token = SecureRandom.urlsafe_base64 end This will modify the remember_token whenever the user is saved – that is, when the user is created or updated. And when a user updates his/her profile, the remember_token is changed. This causes the login system to notice that the … Read more

[Solved] Display the details of only current user who is logged in? [closed]

You need to set the associations between models After that, it could look like this: @students = @user.students.all where @user = current_user I guess. Edit: To make it failsafe: @students = @user.students.all if @user To avoid later problems set user only when its not set by the controller e.g in a user view: @user ||= … Read more