Reputation: 1113
I'm using a link and send some of the parameter with them,
%a{:href => "/auth/#{key}?profile_id=#{@user.id}&profile_type=user}
These parameter goes in session and after that save in db. Before saving in the db, I want to fetch value of these parameter ,for this I use in my application controller:
before_filter :social_media_type
def social_media_type
Rails.logger.debug"***********Session Set*****#{params[:profile_id]}*********#{params[:profile_type]}***"
if params[:profile_type].present? and params[:profile_id].present?
session[:social_profile_type] = params[:profile_type]
session[:social_profile_id] = params[:profile_id]
end
end
But here is a problem, It does not fetch any value when I check it in logger. Is it not correct or have any error? please give your suggestion.
Upvotes: 1
Views: 308
Reputation: 878
Are you sure that your HAML is even parsing. You are missing a closing quote (unless its a typo)
%a{:href => "/auth/#{key}?profile_id=#{@user.id}&profile_type=user"} Hello
Personally I would always prefer a helper tag, because its easier to make changes, like:
= link_to "Hello", auth_path(:key => key, :profile_id => @user.id, :profile_type => "user"
With a route in routes.rb like
match 'auth/:key' => "your_controller#action", :as => :auth
Upvotes: 1