Rails 4 and declarative_authorization gem - ruby-on-rails-4

I'm trying to use declarative_authorization gem within my Rails 4 app but after inserting it within my gemfile gem 'declarative_authorization' and run the bundle command I try to install it with the command
rails g authorization:install UserModel=Professional nome email telefone logradouro numero bairro cep cidade estado profissao tutorial_completo plan_id:index status_id:index --create-user --user-belongs-to-role
but I get the error Could not find generator authorization:install.
What am I doing wrong?
Thank you

Make it get the gem straight from the github repo. I had this same problem and I had a version that was before they added the installer. When I made it fetch the gem from github it got a later version and the installer worked
#Gemfile
gem 'declarative_authorization', github: "stffn/declarative_authorization"

Related

Unable to use spree_advanced_inventory in spree 3.0

While adding spree_advanced_inventory gem to an existing spree application I am getting the following error.
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.6/lib/active_record/dynamic_matchers.rb:26:in
'method_missing': undefined method 'attr_accessible' for
Then I added protected-attributes gem to my gem file, bundle install worked well, but when I tried bundle exec rails g spree_advanced_inventory:install giving me result as
"SPREE doesn't work with protected_attributes gem installed"
spree_advanced_inventory extension is for spree 1.3.2 which was most likely be tested for rails <= 3.x which uses attr_accessible whereas you are using spree 3.0 which uses rails >= 4.x which now supports permitted attributes.
Because of some compatibility issues spree do not support protected_attributes gem hence the error.

rails tutorial could not locate gem file when bundle install

Hi I'm new to Ruby on rails and doing the tutorial on railstutorial.org, I'm stuck on the the first chapter about bundler install.I updated my gem file to what version I want them on but when I go to hello_app directory and type bundle install in in my shell I get a "couldn't find gem file". I type LS or ls in the hello_app directory and gemfile.rb shows up. what am i doing wrong? Ive done a search on this topic for 2 hours I have not found a solution. I have rails 4.2.1 installed but i also installed 4.2.0 because the book calls for this version, don't know if thats the cause.
If you installed rails correctly before creating a new rails app, I'm not sure you'll even need to update your gems with the bundle install
I found out what was wrong. I had saved the Gemfile in a .rb extension thinking it was suppose to be a ruby file. thats why it couldn't find the Gemfile. how I found out was just restarting the rails project from the beginning and do it step by step. I found the original Gemfile didn't have the .rb file extension, so when I tried bundle install it worked. thank for the reply #Mba Uchenna.

I am working to generate nifty_layout in rails 4

Ubuntu 13.10 Terminal
Rails 4.2
Ruby 2.1
nifty-generators (0.4.6)
Command =>
rails generate nifty_layout
result=> Could not find generator 'nifty_layout'. Maybe you meant 'nifty:layout' or 'nifty:config' or 'nifty:scaffold'
Runrails generate --helpfor more options.
Please provide a solution.Thank you
Add this to your gemfile: gem 'nifty-generators', group: :development
Run: bundle install
And then use rails generate nifty:layout

PG pg_ext load error in rails

I recently updated to rails 4.1.6 and ruby 2.1.3p242. I also updated all gems on my system. After creating a new app, I keep getting a pg_ext load file error on running the server. I'm on windows 8 x64 with PostgreSQL 9.3. The pg gem was working fine under my previous RoR installation which was rails 3.2 and ruby 1.9.3.
Under the gem's installation directory, I've a 2.0/pg_ext.so file. I tried renaming the folder to 2.1 and ran the server. The result was the same. I assume it's cause Ruby doesn't allow to Require a .so file. Below is the screenshot of the error:
Any help would be really appreciated. Thanks!
Posted question on the official Gem page:
https://bitbucket.org/ged/ruby-pg/issue/192/pg_ext-load-error
As per the suggestion, I installed the pre-version of the next release. That gave me another error which was solved using:
https://github.com/tzinfo/tzinfo/wiki/Resolving-TZInfo::DataSourceNotFound-Errors
TZInfo::DataSourceNotFound error starting Rails v4.1.0 server on Windows
Posting the answer to help people facing similar problems in the future.
1) In the command line enter:
gem install pg --pre
gem list pg
2) In the Gemfile set the gem to the newly installed version:
gem 'pg', '~> 0.18.2'

No application integration exists for rails. Compass and rails 4

I started a rails 4 project and added the following gem (supposedly, it has rails 4 support)
gem 'compass-rails', '~> 2.0.alpha.0'
However, after bundle install and $ bundle exec compass init I keep getting
No application integration exists for rails.
Anyone knows why ?
Thanks,
I get the same error with compass-rails v1.1.3 and rails 4, when running "bundle exec compass init rails", but when I run "bundle exec compass init" (omitting "rails") it works fine for me. The version of compass-rails you are using has been yanked since last July (see here: http://rubygems.org/gems/compass-rails/versions/2.0.alpha.0).
Remove project_type = :rails from your config file.