RailsCasts Pro episodes are now free!

Learn more or hide this

Arif Usman's Profile

GitHub User: usmanarif

Comments by Arif Usman

Avatar

Ajax search is not working though simple search works fine. I am not getting any error as well in my log file. Following is my code:

show_workers.haml
= form_tag show_workers_agencies_path, :method => 'get' do
= hidden_field_tag :direction, params[:direction]
= hidden_field_tag :sort, params[:sort]
%p
= text_field_tag :search , params[:search]
= submit_tag "Search", :name => nil

workers= render 'workers'

_workers.haml
%table.pretty
%thead
%tr
%th= sortable "name"
%th Phone number
%th City
%th{:colspan => "3"}
%tbody
- @workers_list.each do |worker|
%tr
%td= worker.name
%td= worker.phone_number
%td= worker.city
%br
= paginate @workers_list

show_workers.js.haml
$("#workers").html("#{escape_javascript(render("workers"))}");

agencies_controller.rb
def show_workers
@workers_list = Worker.where(agency_id: current_user.agency.id).order(sort_column + " " + sort_direction).search(params[:search]).page(params[:page]).per(5)
respond_to do |format|
format.html
format.js
end
end

application.js
$(function() {
$("#workers th a").on("click", function() {
$.getScript(this.href);
return false;
});
});

Please tell if I am missing anything.

Avatar

Hello all, Is there any demo application of implementing Riak database using Risky library in Rails application? I've googled alot but didn't find any. Even there is no episode in railscast for the same.

Avatar

Hello all, Is there any demo application of implementing Riak database using Risky library in Rails application? I've googled alot but didn't find any. Even there is no episode in railscast for the same.

Avatar

Can anyone help me out in this. I am using dynamic fields to generate the ranges. It all working fine but now I have to put some validation over it, and have to do it on Client side. Now I have spent three valuable days to find out the answer but yet not successful. Is there any way to generate my own predecided id to each dynamic text field instead of current date and time? So that I can do the validation using that Id. Or do any one have any better idea? Any type of help will be appreciated. Thanks in advance.

Avatar

Can anyone tell me how to do the client side validation in dynamic text fields. How to validate for presence_of for the dynamic text field so that at least one dynamic text field must be present in the form.

Avatar

Hello, I have to clone the image which I have created previously. I am just copying the data present at the image column into my cloned deal image column but this didn't displaying any image. The code is as follows:

Offer.rb

has_attached_file :image,
:styles => {
:thumb=> "100x100>",
:small => "150x150>",
:medium => "300x300>",
:large => "400x400>"
}

Offer_controller

def clone_deal

@deal = Offer.find(params[:id])
@attr = { :nameofdeal => @deal.nameofdeal, :value => @deal.value, :image_file_name => @deal.image,:type => 'image/png'}
@offer = Offer.new(@attr)

Offers/show.html.erb

<% if @offer.image_file_name != nil %>
<%= image_tag @offer.image(:large),:class=>"offer_deal_image" %>

<% end %>

Avatar

Is there any way to get the value of dynamically added text fields( not just the value of one text field) before saving it in my database? I have searched it in google but found no clue. Can any one help me? Thanks in advance.

Avatar

On using the above procedure, I get the following error message:

undefined method `error_message' for #ActionView::Helpers::FormBuilder:0x9fa7f54

Can anyone help me?? Thanks in advance..!!

Avatar

Bad Luck..Date picker is coming but still the values are changing only in the first text field only...every other text fields remain empty....!!! Is anyone out there can help me???

Avatar

Thanx 'ed'..Your code for dynamic date fields really helped me...I've lost my 1 week over this....Thank you..!!

Avatar

I have three queries:

1) How do I assign and get the unique Id to each text box generated dynamically?

2) How do I resolve the conflict occur between jquery of datepicker and the code <%= javascript_include_tag "application" %>

3) How can I use datepicker function in each text box as datepicker uses the unique Id of each text box.