[Solved] Resolve Fixnum error [closed]

You are calling the employee_id method on authorization_selectedwhich is a String and does not provide this method. Obviously this does not work. You probably want to do @portability = Portability.new @portability.employee_id = authorization_selected assuming that params[:employee] contains the employee_id and Portability is an ActiveModel or an ActiveRecord. Perhaps you can change your form that the … Read more

[Solved] I am getting error while trying to login through valid email and password,which is stored in the database

Hey just remove attr_accessor :password from model. It works class User include Mongoid::Document attr_accessor :password//remove this line field :name, type: String field :category, type: String field :email, type: String field :password, type: String validates :name, presence: true ,format: { with: /\A[a-zA-Z]+\z/} validates :email, presence: true , format: { with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i } , uniqueness: { case_sensitive: … Read more

[Solved] Ruby on Rails – Facebook

I used oauth2 gem for similar thing, here’s a simple example on how to connect with it to facebook: http://wiki.github.com/intridea/oauth2/rails-23-webserver-example (but you don’t really need a separate controller for that) Also, see ‘Requesting Extended Permissions’ section here, you’ll need ‘publish_stream’ permission to post content: http://developers.facebook.com/docs/authentication/ solved Ruby on Rails – Facebook

[Solved] How to retrive data from database in the form of grid in ruby on rails

your “col-md-3” is missing “, and you have to put the column size inside the loop each, here is your revision that you can try <div class=”row”> <% unless @fridges.blank? %> <% @fridges.each do |fridge| %> <div class=”col-md-3″> <div class=”card card-cascade narrower”> <div class=”view overlay hm-white-slight”> <%= image_tag(fridge.image.url(:medium), :alt => “Fridge Item”, :class => “img-fluid”)%> … Read more

[Solved] ruby on rails – current_user on model

current_user is a devise helper to be used on Views and Controllers. If you have an instance method that needs the current_user you should probably move it’s logic to a Controller. It’s better explained here: Access to current_user from within a model in Ruby on Rails solved ruby on rails – current_user on model

[Solved] Two form_tag on the same haml page

Form_tag (under haml) doesn’t generate </form> into final source. form_for works fine. To get correct final source, form_tag has to be use with do. So correct first line will be = form_tag({action:’index’}, {method: :get}) do solved Two form_tag on the same haml page

[Solved] hash inside liste of hash extracted from array [closed]

I’m not sure what exactly you want to do, but you can try the following: arr = [“Japan”, “Egypt”, “Spain”, “Brazil”] arr.each { |a| Object.const_set(a, Hash.new(a)) } #initialize hashes Country = arr.map {|a| [a, 0]}.to_h #=> {“Japan”=>0, “Egypt”=>0, “Spain”=>0, “Brazil”=>0} or Country = Hash[arr.map {|a| [a, 0]}] #=> {“Japan”=>0, “Egypt”=>0, “Spain”=>0, “Brazil”=>0} Note: Ruby variables … Read more