How to Remove Box Shadow from Elements

A lot of developers and designers work with bootstrap nowadays and sometimes you need to override rules created by default by the framework. Here’s something I needed to remove a while back.

.progress {
    -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15);
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15);
}

Progress bars have a default box-shadow. To remove it, simply add a rule to change the value to none

// from bootstrap
.progress {
    -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15);
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15);
}

//custom
.no-shadow {
    -webkit-box-shadow: none;
    box-shadow:none;
}

Apply this to your own elements

<div class="progress no-shadow">
  <div class="progress-bar no-shadow"></div>
</div>

Done!

.

 PG::DuplicateTable: ERROR: relation "table_name" already exists

StandardError: An error has occurred, this and all later migrations canceled:

PG::DuplicateTable: ERROR:  relation "table_names" already exists
: CREATE TABLE "table_names" ("id" serial primary key, "name" character varying, "owner_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 

This error show when you try to migrate a while the table is already existing.

This error is a result of deleting migration files instead of using the the rails rollback.

Solution

Delete the table using your console

your_app_development=# drop table table_name;
DROP TABLE

 Rails: Generate Model without Migration file

Rails allows you to generate models. Rails model generation will also generate a migration file which lets you generate the table and fields on the designated table. This is a normal `Rails generate model`

$ rails g model YourModel
      invoke  active_record
      create    db/migrate/20170507051508_create_your_models.rb
      create    app/models/your_model.rb
      invoke    rspec
      create      spec/models/your_model_spec.rb
      invoke      factory_girl
      create        spec/factories/your_models.rb

To generate a model without a migration file:

$ rails g model YourModel --migration=false
      invoke  active_record
      create    app/models/your_model.rb
      invoke    rspec
      create      spec/models/your_model_spec.rb
      invoke      factory_girl
      create        spec/factories/your_models.rb

The key is to set the --migration to false

 Print the Page content in Capybara

Capybara is arguably one of the most used tools in testing in Ruby on Rails. If you need to show the content of the page you are testing, you can use the following command

page.body

This is helpful if you want to see what the problem is with your tests.

There is another really helpful command that you can use.

save_and_open_page
=> #<Process::Waiter:0x007fe07aecbbe0 sleep>

This will open a web browser page and show the content. You wouldn’t see any design here.

Screen shot 2017 04 26 at 8.45.51 pm