I have a sign up with facebook text link in my app. I tried to add class to this text link to turn this into a button.
In rails it's written like this to display that text.
= link_to_session
So, as a rule I added the following
= link_to_session 'sign up', class: 'button button-primary'
but it gave me an error...
wrong number of arguments (2 for 0)
How could I fix this...? Thank you for your time!
UPDATE sorry.. I'm not quite sure where to look at...
I looked at session controller and in controller following is written...
class SessionsController < ApplicationController
def create
auth = request.env["omniauth.auth"]
user = User.find_by_auth(auth)
if user.blank?
if session[:user_id].present?
# via token
user = User.find(session[:user_id])
user.definitive_by(auth)
else
# new user
user = User.find_or_create_by_auth(auth)
end
else
user.token = auth.credentials.token
user.save!
end
session[:user_id] = user.id
redirect_to root_url
end
def create_via_token
session[:user_id] = params[:user_id]
redirect_to '/auth/facebook'
end
def destroy
session[:user_id] = nil
redirect_to root_url
end
end
Try the following
= link_to 'sign up', "write your path here", class: 'button button-primary'
Here session path should be present in your route.