How to pass a parameter needed in before_filter in the controller ?
So given a controller as follows:

class AccountsController < ApplicationController
  before_filter :signed_in_user
  before_filter :find_client, only: :create

  def create
    @client.accounts.create!
    flash[:success] = t(:created_success, model: Account.model_name.human)
    redirect_to @client
  end

private
    def find_client
      @client = Client.find(params[:account][:client_id])
    end

end

As you see, I pass a client_id to create an account as accounts resources 
are defined in the context of clients. There is no new view, the account 
number is generated by the Account model method.
Any idea?
Thanks



-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/rspec/-/vk9K41Ic_mkJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to