undefined method 'grid' for ## Class: 0x007f89aefb1370: 0x007f89b035c078 [closed]

1

ERROR: undefined method grid 'for # < #: 0x007f89b035c078 >'

home.haml

.full-height.row.middle-xs.white-text.center-xs.main-background.no-margin{style: "background-color:red;"}
=grid xs:10,sm:8,md:6,lg:4 do
    .big-padding.blue.text-left.white-text
        %h1.no-margin.bold.light-blue-text Social Network
        %p.no-margin Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempora autem facilis, culpa doloremque blanditiis. Pariatur nesciunt quas neque, tempora ipsam unde, ab quae, laboriosam eos consequatur enim numquam recusandae asperiores.
        .top-space

Gemfile

...
gem 'rails', '~> 5.1.3'
gem 'flexbox_rb'
gem 'haml-rails'
...

application.scss

 *= require flexboxgrid
 *= require colors
 *= require common
 *= require main
 *= require_self
    
asked by Matias Carpintini. 10.08.2017 в 17:51
source

1 answer

0

Apparently the gem does not work with rails 5.x , in fact the last uploaded change is from 2 years ago, so the most likely thing is that the project is abandoned.
The best you can do is use the flexbox library directly from your source instead of using outdated wrappers. Your options, from the simple to the most complex are:

  • Access the css contained in your cdn with:

    %link{:href => "//cdnjs.cloudflare.com/ajax/libs/flexboxgrid/6.3.1/flexboxgrid.min.css", :rel => "stylesheet", :type => "text/css"}/
    
  • Download the library and add it to your assets folder.

  • Use webpacker and add it to your package.json with npm i flexboxgrid --save

Then instead of doing:

=grid xs:10,sm:8,md:6,lg:4 do

You should use something like:

.col-xs-10.col-sm-8.col-md-6.col-lg-4
    
answered by 10.08.2017 / 23:05
source