Did you try 

render :super



On Saturday, July 11, 2015 at 6:45:55 AM UTC-4, Ruby-Forum.com User wrote:
>
> hi everybody! 
> Link to question on http://stackoverflow.com/q/31350221/2895006 
>
> As everybody usually says, I'm newbie in Ruby on Rails) and have 
> following issue: 
>
> I have a search form 
>
> https://www.dropbox.com/s/hmr85xh3ra28nsf/Screen%20Shot%202015-07-10%20at%2023.19.07.png?dl=0
>  
>
> and I would like to have ability to add new msisdn if it doesnt exist. 
> So I make fake insert and want to add conditional link to my 
> active_scaffold grid instead of currently exist ones: 
>
> config.action_links.add :submit_create, :label => "Create blacklisted 
> user", :type => :record, :confirm => "Are you sure?", :inline => true, 
> :method => :get 
> Here is my controller 
>
> >class CCare::UserstatusController < ApplicationController 
>
> >before_filter :filter_search 
>
> >  verify :method => :post, 
> >         :only => :stop, 
> >         :redirect_to => { :action => :index } 
> > 
>
>     >  active_scaffold :users do |config| 
>     >    config.label = "User Status" 
>     >    config.list.columns = [:msisdn, :user_agent, :network ] 
>     >    config.actions = [:search, :field_search, :list, :nested] 
>     >    config.actions.swap :search, :field_search 
>     >    config.field_search.columns = [:msisdn] 
>     >    config.columns[:id].label = "ID" 
>     >    config.columns[:id].search_sql = "users.id = ?" 
>     >    config.columns[:id].search_ui = :text 
>     > 
>     >    config.columns[:msisdn].search_sql = "users.msisdn = ?" 
>     >    config.columns[:msisdn].search_ui = :text 
>     > 
>     >    config.columns[:network].sort = {:sql => "network.network" } 
>     >    config.columns[:network].search_sql = "network.network" 
>     >    config.columns[:network].search_ui = :select 
>     >    config.columns[:network].actions_for_association_links = 
> [:show] 
>     >    config.columns[:user_agent].label = "Device" 
>     >    config.nested.add_link("Subscriptions", [:user_service_list]) 
>     >    config.nested.add_link("Contact History", [:user_contact]) 
>     >      config.action_links.add "show_stop_all", :label => "Stop 
> All", :type > => :record, :crud_type => :create, :inline => true, 
> :position => :after 
>     >    config.list.always_show_search = true 
>     >  end 
>
>     >  def update_table 
>     >    if params[:search].nil? and params[:nested].nil? 
>     >      render :partial => "shared/empty_list", :layout => false 
>     >    else 
>     >      if not params[:search][:id].nil? and not 
> params[:search][:id].empty? >and not params[:search][:id] =~ /^[0-9]+$/ 
>     >        flash[:error] = "ID is not a number" 
>     >        render :partial => "shared/empty_list", :layout => false 
>     >        return 
>     >      end 
>     >      if (is_msisdn_exist) 
>     >        super 
>     >      else 
>     >        user = User.new 
>     >        user.msisdn = params[:search][:msisdn] 
>     >        user.user_list_id = 1 
>     >        user.save 
>     >        super 
>     >      end 
>     >    end 
>     >  end 
> I tried to put method is_msisdn_exist into 
>
> active_scaffold :users do |config| 
>   .... 
> end 
> but it returned error: method not found. How can I implement my 
> conditional link? 
>
> -- 
> Posted via http://www.ruby-forum.com/. 
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8f49c475-e4cd-4e01-995d-97b423b21240%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to