i have installed ActiveAdmin and Devise, but when i trye to log in as User, it displays wrong CSS styling. have tryed many times, it still the same..
When i go to localhost:3000/admin -> it displays good looking Login form.
When i go to localhost:3000/users/sign_in -> it displays bad looking Login form, inherited from ActiveAdmin Login form.
I installed them like this:
gem 'activeadmin', github: 'gregbell/active_admin'
gem 'ransack', github: 'activerecord-hakery/ransack'
gem 'devise'
$bundle install
$rails g devise:install
$rails g active_admin:install
$rails g devise user
$rake db:migrate
I've tryed many different ways, looked up in internet but all information is so old.. and my stylings of devise sign in and sign up is really wrong..
This is my GemFile
source 'https://rubygems.org'
gem 'rails', '4.1.1'
gem 'sqlite3'
gem 'activeadmin', github: 'gregbell/active_admin'
gem 'ransack', github: 'activerecord-hackery/ransack'
gem 'devise'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'tzinfo-data', platforms: [:mingw, :mswin]
I'm not at home and I don't have access to my PC so I am not able to give you 100% answers(name of the files etc..) however I had the same problem and I solved the same issue by putting the stylesheet of activeadmin into the vendors directory.
Related
I have a legacy Rails 3.2 app and if I have a JavaScript file at:
app/assets/javascripts/jt.js
I'm able to access it at
https://dev-platform.domain.com/assets/jt
We are using the asset pipeline and I'm not sure why this is available. It seems like something in assets/javascripts or assets/styles will show up. Is this the intended behavior? How can I prevent this?
Here's my Gemfile#assets
group :assets do
gem 'coffee-rails', '3.2.2'
gem 'font-awesome-sass', '4.7.0'
gem 'foundation-rails', '6.1.2.0'
gem 'jquery-rails', '3.1.4'
gem 'jquery-ui-rails', '5.0.5'
gem 'sass-rails', '3.2.6'
gem 'turbo-sprockets-rails3', '0.3.14'
gem 'twitter-bootstrap-rails', '2.2.8'
gem 'uglifier', '2.7.2'
end
I'm totally noob, and doing the Learn Ruby On Rails Book One from start. I've got stuck a couple of times, but have resolved it myself by google, stackoverflow, etc... (I don't want to be a burden) But this I can't get by.
I'm on the Gemfile "chapter". First I just tried to copy the exact as it is in the book:
source 'https://rubygems.org' ruby '2.0.0'
gem 'rails', '4.0.1'
# Rails defaults
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0' gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0' gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
# learn-rails
gem 'activerecord-tableless'
gem 'compass-rails', '~> 2.0.alpha.0' gem 'figaro'
gem 'gibbon'
gem 'google_drive'
gem 'high_voltage'
gem 'simple_form'
gem 'zurb-foundation'
group :development do
gem 'better_errors' gem 'quiet_assets' gem 'rails_layout'
end
Which gives me this result:
[!] There was an error parsing `Gemfile`: syntax error, unexpected tIDENTIFIER, expecting gem 'rails', '4.0.1'...https://rubygems.org' ruby '2.0.0'
... ^. Bundler cannot continue.
# from /Users/MYUSERNAME/Projects/learn-rails/Gemfile:1
# -------------------------------------------
end 'better_errors' gem 'quiet_assets' gem 'rails_layout'
I then tried to change a few things like versions and so on, like this:
source 'https://rubygems.org'
ruby ’2.3.3’
gem 'rails', ’5.0.1’
# Rails defaults
gem 'sqlite3'
gem 'sass-rails', '~> 5.0’
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2’
gem 'jquery-rails'
gem 'turbolinks’
gem 'jbuilder', '~> 2.5’
# learn-rails
gem 'activerecord-tableless'
gem 'compass-rails', '~> 2.0.alpha.0'
gem 'figaro'
gem 'gibbon'
gem 'google_drive'
gem 'high_voltage'
gem 'simple_form'
gem 'zurb-foundation'
group :development do
gem 'better_errors'
gem 'quiet_assets'
gem 'rails_layout'
end
This gives me this result:
[!] There was an error parsing `Gemfile`: no .<digit> floating literal anymore; put 0 before dot - ruby ’2.3.3’
^
/Users/MYUSERNAME/Projects/learn-rails/Gemfile:2: syntax error, unexpected tFLOAT, expecting '('
ruby ’2.3.3’
^. Bundler cannot continue.
# from /Users/MYUSERNAME/Projects/learn-rails/Gemfile:2
# -------------------------------------------
# source 'https://rubygems.org'
> ruby ’2.3.3’
# gem 'rails', ’5.0.1’
# -------------------------------------------
I've tried a few things I found when searching, like changing the ' to " on the ruby version, putting a '0.2.3.3' or just '.2.3.3', doing a bundle update, etc. I don't know what the the "no . floatin..." means? Or what the "expecting '('" is?
I really have searched and tried various solutions (got like 4-5 different saved "Gemfile" from trying whatever I found on the net).
Sorry if this just takes up space in the interwebs, but I just don't get it. If the original (from the book) doesn't even work, then why is it even there?
(I only changed my personal name to MYUSERNAME here, because it's my full, actual name, and maybe I'm paranoid but may so be. So that is not a fault)
Thanks,
Ethonrails
Make sure you use ' not ’ it's a different kind of apostrophe. (Everywhere in your Gemfile, I see a couple of instances ruby ’2.3.3’, gem 'sass-rails', '~> 5.0’)
Here is a version of your Gemfile that works:
source 'https://rubygems.org'
ruby '2.3.3'
gem 'rails', '5.0.1'
# Rails defaults
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.5'
# learn-rails
gem 'activerecord-tableless'
gem 'compass-rails', '~> 2.0.alpha.0'
gem 'figaro'
gem 'gibbon'
gem 'google_drive'
gem 'high_voltage'
gem 'simple_form'
gem 'zurb-foundation'
group :development do
gem 'better_errors'
# gem 'quiet_assets' (not compatible with rails 5 atm)
gem 'rails_layout'
end
Tip: Try to use a code editor with syntax highlighting for Ruby, that should make future syntax errors easier to spot.
Try to replace ` characters to '
Instead of back quote (`), use single quote (') in your Gemfile.
As you are learning ruby on rails, I would like to suggest this link which may be useful to you, http://guides.rubyonrails.org/getting_started.html
I am new to Ruby on Rails(4.1.8) and using OS Windows 8, I have added the gem activeadmin in my gemfile and ran commands
rails g active_admin:install --skip-users
rake db:migrate
rails server
but I get the following exception while running http://localhost:3000/admin
TypeError: Object doesn't support this property or method (in
c:/Sites/CleverChalk/app/assets/javascripts/active_admin.js.coffee)
Could someone please advise why this occurs. i read a couple of post on
coffee-script-source and
coffee-rails but they have not worked for me.
My Gemfile is as below :
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
gem 'pg'
gem 'activeadmin', github: 'activeadmin'
gem 'coffee-script-source', '1.8.0'
gem 'coffee-rails', '~> 4.0.0'
# 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'
# 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
# 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]
I could resolve the issue by reinstalling activeadmin with Users that meant adding the devise gem as shown below:
gem 'devise'
to the gemfile and then
bundle install
rails generate devise:install
Thanks.
I want to use casual css or maybe scss for bootstrap/flatui generates. However, my generated bootstrap:install and flatuipro:install produces a .less files. I have many problems with .less such as window version of therubyracer wreck my rails page, so I don't want to use it.
Here is my Gemfile
source 'https://rubygems.org'
ruby '1.9.3'
#ruby-gemset=mybook_rails_4_0
gem 'rails'
group :development do
gem 'sqlite3'
end
group :production do
gem 'rails_12factor'
gem 'pg'
end
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'haml'
gem 'haml-rails'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder'
gem 'twitter-bootstrap-rails'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'designmodo-flatuipro-rails', '1.1.3.1'
gem 'formtastic'
gem 'protected_attributes'
gem 'angularjs-rails'
group :doc do
gem 'sdoc', require: false
end
Here is the command I used to generate bootstrap and flatuipro
rails g bootstrap:install
rails g flatuipro:install <flatui-directory>
Here is the files created in assets/stylesheet
flatuipro.less
bootstrap_and_override.css.less
Ok, I switched to rails g bootstrap:install static, which doesn't depend on less anymore... sad story, I'll have to rollback to basic css bootstraps
I got an issue here. I'm working on an app built with Rails and Backbone. In my development environment, everything's run well, but when I deployed it to the production server, this error showed in my firebug :
TypeError: this._reset is not a function
...;return a.success=function(d,e,f){ba.add?"add":"reset",c&&c(b,...
Could anyone help me on this?
Revision 1
I've precompiled the assets and this is my Gemfile :
source 'https://rubygems.org'
gem 'rails', '3.2.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'devise', '1.5.3'
gem 'friendly_id'
gem 'pry'
gem "paperclip", "~> 2.5.0"
gem "kaminari"
#gem "ckeditor", "3.7.0.rc3"
gem "tinymce-rails"
gem "puma"
gem "tlsmail"
gem "rails-erd"
gem "juggernaut"
gem "thin"
#gem 'execjs'
#gem 'therubyracer'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
Anyway, I got this new fact. I tried run the app in production mode in my local machine and it ran well, but not in my server. Is there anything that I forgot to install in my server?
It seems that you install backbone manually.
I recommend using something like backbone-rails gem to help integrating rails and backbone gracefully. Something like https://github.com/codebrew/backbone-rails (there are also other gem around, but codebrew implementation is one of the most popular).
This is to ensure consistent dependency across machines.
Don't forget to read about asset pipeline, most of my problem with js and rails in production comes from my lack of understanding regarding rails 3 asset pipeline: http://guides.rubyonrails.org/asset_pipeline.html
And if you're serious about integrating backbone and rails, https://learn.thoughtbot.com/products/1-backbone-js-on-rails is an indispensable resource (at US$ 49)
EDITED:
This is my typical Gemfile when creating backbone.js & rails app:
group :assets do
gem 'haml-rails', '~> 0.3.4'
gem 'sass-rails', '~> 3.2.5'
gem 'bootstrap-sass', '~> 2.0.3.1'
gem 'compass', '~> 0.12.1'
gem 'compass-rails', '~> 1.0.2'
gem 'coffee-rails', '~> 3.2.2'
gem 'jquery-rails', '~> 2.0.2'
gem 'jquery-ui-rails', '~> 1.1.0'
gem 'handlebars_assets', '~> 0.4.4'
gem 'rails-backbone', '~> 0.7.2'
# javascript
gem 'haml_coffee_assets', '~> 1.2.0'
gem 'execjs', '~> 1.4.0'
gem 'therubyracer', '~> 0.10.1'
gem 'uglifier', '~> 1.2.4'
gem 'yajl-ruby', '~> 1.1.0'
end