ruby-on-rails-plugins

What is a suitable testing framework for Rails 3?

一个人想着一个人 提交于 2019-12-10 11:14:46
问题 I am working with Ruby On Rails for the last year. But, could not work on Unit Testing. Now I have to write a unit testing code. Which testing framework is good and why? Is there any good tutorial for this? My system configuration: Ruby 1.9.2, Rails 3, Ubuntu 10 回答1: The first tip is: Try upgrading to Rails 5.x. This is good practice to always leave your system clean and faultless from third parties. Your greatest friend will always be the rails documentation: http://guides.rubyonrails.org/v3

Rails - how to use a plugin from github (how to install, utilize, etc)

妖精的绣舞 提交于 2019-12-10 11:05:59
问题 I'm trying to install a couple of different plugins for my rails 3 app. I cd to '/vendor/plugins/', then type git clone the_git_src_url . I see the files in the /vendor/plugins/ directory. However when I try to use any of the tags provided by the plugin I get uninitialized constant ContentsController::HTMLToTextileParser PriceTag and html2textile are the two plugins I'm trying to use. This is what triggers the error above: <%= PriceTag.html_to_textile(@content.desc) %> I'm working in

How to Install wkhtmltopdf?

戏子无情 提交于 2019-12-10 10:52:10
问题 Now i am working on rails 3.0.0.i am using Ubuntu 11.10 ,64 bit os.i want to install wkhtmltopdf.please tell me the static version of wkhtmltopdf. 回答1: Installing wkhtmltopdf on Ubuntu Linux machine First check os is 32 bit or 64 bit by using following command Try uname -m . It seems like the uname -m actually gives x86_64 when it is an kernel 64 bits Run following command sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev Then run following command sudo apt-get

How exactly do I install restful authentication plugin in rails 3?

 ̄綄美尐妖づ 提交于 2019-12-10 10:29:05
问题 I'm very confused on this restful authentication plugin on rails 3. I tried to install the plugin using the following command. It tells me it's already installed, then I tried to use the --force to reinstall this plugin it tells me that the plugin not found So if the plugin is already installed why do I get error Could not find generator authenticated when I try to run the command rails g authenticated user sessions --include-activation any ideas? C:\Users\Jonathan\Documents\blog>rails plugin

can you pass self to lambda in rails?

这一生的挚爱 提交于 2019-12-09 22:58:34
问题 I want to define a class method that has access to a local variable. So this would be different for each instance of the class. I know you can make a class method dynamic with lambda like when you use it with named_scope. But can this be done for values that are specific to an instance? In detail it is the has_attached_file method for the paperclip plugin in rails. I want to pass a lambda for the styles hash so that the image styles can be based off of attributes of the object stored in the

Rails Dynamic Role-Based Authorization plugin?

早过忘川 提交于 2019-12-09 22:32:08
问题 There are a lot of role-based authorization plugins out there. They work great when you know in advance what the roles are going to be. For example, if I know I'm going to have administrators, super_users, and not_so_super_users. What I really want is to be able to create custom roles and assign that role to a user. At this point, I am simply wanting to block access to controllers / actions based on a user's custom role. Roles will consist of permissions. For example, Jane Doe can add and

Rails plugin development documentation and resources

梦想的初衷 提交于 2019-12-09 06:48:00
问题 Are there any resources or documentation for developing Rails plugins? I'm using other plugins as examples, but it's hard to know if I'm doing something wrong, or if there's another way to do something. All I can find are old blog posts. I haven't found any documentation on how to develop plugins and what functionality/hooks are available. 回答1: Check this very good list: HOWTO: Make A Rails Plugin From Scratch Rails Plugin Tutorial Demystifying Rails Plugin Development How to write a Rails

Why Railtie initializers are not executed?

£可爱£侵袭症+ 提交于 2019-12-08 17:24:38
问题 While crafting the Passenger-Monit plugin, I thought that it'll be most appropriate to use the initializer, i.e. module PassengerMonit class Railtie < Rails::Railtie initializer "my_plugin.some_init_task" do # my initialization tasks end end end However, for some reason the code in the block was never executed. I finally made a work-around with config.before_initialize {} but I'm curious, why the initializer wasn't executed. What could have prevented it from running? 回答1: In your gemfile, did

How do I use Haml in a view in my new plugin?

纵饮孤独 提交于 2019-12-08 13:09:25
问题 I'm creating a new plugin for a jruby on rails application that will eventually be turned into a gem. Inside my plugin I have controllers, helpers and views. For my views I'd like to use Haml. The problem is that I can't seem to get it to recognize that they are haml templates. Is it even possible to do this? Is there a way for a plugin to have Haml as a dependency for its view? And by that I mean, I intend for the plugin that I'm creating to have a view created by the plugin, that can be

How can I prevent Rails from “pluralizing” a column name?

…衆ロ難τιáo~ 提交于 2019-12-08 07:52:41
问题 I'm using dwilkie's foreigner plugin for rails. I have a table creation statement that looks like: create_table "agents_games", :force => true, :id => false do |t| t.references :agents, :column => :agent_id, :foreign_key => true, :null => false t.references :games, :column => :game_id, :foreign_key => true, :null => false end However, this generates the following SQL: [4;35;1mSQL (2.7ms)[0m [0mCREATE TABLE "agents_games" ("agents_id" integer NOT NULL, "games_id" integer NOT NULL) [0m I want