i'm currently working on a University project, and i have to deploy a web page using Rails. Using Materialize Css for rails, the only way that, on a form, the element "Select" works is reloading the page, also for others javascripts it seems that they only works reloading the page... Now i'm using a "script" that reloads once the page but its totally a bad practicing
here you have the Application.js
//= require jquery
//= require jquery.turbolinks
//= require jquery_ujs
//= require materialize-sprockets
//= require_tree .
//= require turbolinks
the gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.4'
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
#gem 'pg', group: :production
#gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'hirb'
gem 'carrierwave'
#gem 'bootstrap-sass', '~> 3.3.0'
gem 'devise'
gem 'rolify'
gem 'cancan'
gem 'will_paginate'
gem 'will_paginate-bootstrap'
#gem "twitter-bootstrap-rails"
gem 'therubyracer', :platform => :ruby
gem 'materialize-sass'
gem 'rails_12factor', group: :production
gem 'puma'
gem 'cloudinary'
#gem 'libv8', '3.11.8.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
applications.scss
@import "materialize";
and finally the _form
<script>
$(document).ready(function() {
$('select').material_select();
});</script>
<div class="container">
<%= form_for @articulo, :html =>{:multipart => true} do |f| %>
<div class="row">
<div class="input-field col s6">
<%= f.text_field :nombre%>
<label for="first_name">Nombre del producto</label>
</div>
<div class="input-field col s6">
<%= f.text_field :ubicacion%>
<label for="ubicacion">Ubicación</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<label for="precio">Precio $</label>
<%=f.text_field :precio, :class => 'text_field', :min => 0, :step => 0.01, required: true%>
</div>
</div>
<div class="file-field input-field">
<div class="btn">
<span>Imagen</span><input type="file">
<%= f.file_field :foto %>
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text">
</div>
</div>
<div class="row">
<div class="input-field col s12">
<%= f.text_field :descripcion, :class=> "materialize-textarea"%>
<label for="textarea1">Descripción</label>
</div>
</div>
<div class="row">
<div class="col s6" id="category_id">
<%= f.label :category_id, 'Categoría' %>
<%= collection_select(:article, :category_id, Category.where(eliminado: false).all , :id, :nombre,class: "browser-default") %>
</div>
</div>
<br>
<%= f.submit "Publicar", class: 'btn ' %><%end%>
</div>
------- Edit------ i 've solved this problem; locally it works but when i upload it into Heroku, happens the same... any solution? or how could i update gemfile in heroku?