I wanna to add to my blog a counter for displaying, how many times was an article displayed. I would like to solve it through ruby (not GA or something like that).
Is available any gem that do this task (also with checking IP address and the time of latest reading of article) or I have to implement by myself?
There's one used by thousands of people at http://www.seologic.com/webmaster-tools/counters. Source code is available at https://github.com/ivanoblomov/hit_counter.
Related
What is the best way to extent and contribute to a rails gem/engine
I have found this blog gem/engine , which I want to use it in my rails3 application.
But there are few modifications / features I would like to have and I'm willing do code them. And after that I would like to add them to the original gem/engine (if the author permits)
But I'm confused with how and where to code and test my new changes.
So far I have done the followings
1 - Fork the gem/engine to my github account
2 - clone the source to my local machine
3 - created a sample rails app and added the gem (from my github account)
My question is,
How can I do the code changes to the gem and test them. Gem itself has used rspec and I could do that too, but some of the changes I'm planning (like layout changes), is litttle hard to check with rspec.
this gem in using rails > 3
There is an excellent ScreenCast about it: RailsCasts: Contributing to Open Source
I have a website that I made using ruby on rails at www.tradespring.net. I want to create a bunch of instances, like www.tradespring.net/electronics, www.tradespring.net/automotive, ect. where these sub-sites work exactly the same as the original but each have their own set of posts, but users are the same across all sub-instances.
Where could I start looking? I don't even know good keywords to google at the moment.
You can start with two best webcasts created by Ryan lately which explains creating multitenancy application in Rails.
Multitenancy with Scopes
Webcast: http://railscasts.com/episodes/388-multitenancy-with-scopes
Source Code: https://github.com/railscasts/388-multitenancy-with-scopes
Multitenancy with PostgreSQL
Webcast: http://railscasts.com/episodes/389-multitenancy-with-postgresql
Source Code: https://github.com/railscasts/389-multitenancy-with-postgresql
[update] Oh! I missed that these are pro webcasts. Though you can check source code of these webcasts.
I'm new to building a rails 3 app with multiple language support. The product requires that the translation team should be able to updated phrases from web interface and see its effects on refresh. They are not concerned about the performance hit this model carries.
So i'm using the gem i18n-active_record and its backend with i18n. The problem is, that translations stored in the db are not fetched on every request. I want the system to query the translations table for each key every time it gets the rendering request.
We're to disable this later when the site is mature enough, but this is an essential feature for now. Any ideas?
You could add in your ApplicationController:
before_filter { I18n.reload! }
I'm afraid I can't really comment on using i18n-active_record, but we run a staging server with the localeapp gem running in daemon mode. This means that translations can be editing via a GUI by a translator and they appear instantly on the staging server. Might be something worth looking into for you.
Disclosure: I'm a developer for Locale
I have developed a database backed application in Rails 3 www.pajamadeals.in . Now, I intend to include search feature in it. Where people can search books, instruments, etc. How do I implement search feature. Any gem or plugin recommendation? Should I roll my own code for search capability?
There are couple of gem is usefull for full text searching
1) You can use thinking-sphinix,for quick start up you can refer http://railscasts.com/episodes/120-thinking-sphinx,
2) You can use solr you can refer http://railscasts.com/episodes/278-search-with-sunspot
3) Elastic Search
Sphinix is a good solution fr easy start.
I'd like to add a CMS and blog to a web app. One that won't get in the way. There's not a lot of content, but enough that we want non-devs to be able to revise pages and probably add and remove them too.
We have a substantial app that can't be touched by the CMS, not a site that we're migrating.
How have you dealt with this situation?
Would you advise:
Running two apps (a content app and the 'app' app)
Plugging in a light weight CMS
Rolling our own using gems/plugins for WYSIWYG
Details
We'll be adding a bug ticketing and support system later too. Probably built into the app.
We'd like the users of the app to be able to comment on pages and blog posts, file tickets, etc. all from their main account, so it seems to make sense to build it into our app, rather than as an extra app. Love to hear war stories on this.
Should be:
Unobtrusive (Shouldn't interfere with the existing app)
Must not mess with Devise, DeclarativeAuthorization, or Omniauth. We've got extensive user accounts, permissions, authentication mechanisms and groups setup. These must stay.
Lightweight (prefer something dev friendly than feature loaded)
Desired Features:
Basic WYSIWYG for content editors
Lets us handle accounts (with Devise)
and maybe even permissions (with DeclarativeAuthorization)
I've read this similar question, but the author seems willing to have something a bit more intrusive.
Simple Rails 3 CMS Gem/Plugin?
Options Found
Refinery seems to have a lot of features, but at a cursory look it needs a lot of control over what's going on: http://refinerycms.com/guides/attaching-refinery-cms-to-an-existing-rails-application It says it's modular, but it seems like there's a big chunk of non optional stuff in there.
Radiant seems a bit monolithic as well
http://groups.google.com/group/radiantcms/browse_thread/thread/b691cf9ab644a8b2
ComfortableMexicanSofa seems a bit closer to what I want: https://github.com/twg/comfortable-mexican-sofa
Adva-Cms has the right philosophy but appears to be dead. Adva-Cms2 isn't ready
http://adva-cms.org/
Governor seems good, but maybe a bit too young and lean
https://github.com/carpeliam/governor
Conclusion
So far rolling our own, or using ComfortableMexicanSofa seems like the bet, but I'd like your thoughts before I spend a few days messing around with it.
I am now rolling my own blog app and I am kind of newbie to Rails 3. Even like that, in 1 week i have a blog with tags, comments, authentication with omniauth, etc.. my advise is: roll your own. I was having the same doubt and looking for pre-made solutions and I decided to start it from zero and just look for plugins for anything i need.
It goes pretty fast if you know already some rails programming and you use the right plugins. This is what i used:
Omniauth to let users be able to autenticate with facebook, twitter etc.. and leave you comments.
rails_admin: it allows you to manage your blog by going to yourapp.com/admin. It uses devise to create an Admin user (you can specify a diferent model name than user to not to mix it with the users from omniauth or from your other app) and if you have the right models and associations between them you can from there create your posts, assign them tags or categories and also delete comments etc.. its all done in an easy way. For the Text Area that you use to introduce the content of your posts you can associate it with the ckeditor just by adding to the rails_admin initializer something like:
config.model Post do
edit do
field :body, :text do
ckeditor true
end
end
end
And with the ckeditor you can introduce pictures, attach videos, format text, and so on.
Use kaminari for pagination, or you can use will_paginate if you are more used to that.
Using the blueprint framework for styling with css you will save time and have a more standar styling.
Use few jquery lines to insert/delete comments graciously.
And that's all I can remember now. And if it shouldn't interfere with the main app, i would just assign a subdomain for it. So if you go to blog.myapp.com you access to the blog and if you go to myapp.com you access to the app. And you want users from the app to interact with the blog so you should use just one app and have this 2 subdomains pointing at differents parts of the same a app.. take a look at: rails 3 - one app, multiple domains, how implement a different 'root' route for one of the domains?
That's all i can think now! let me know if i can help you in anything else.
rails_admin: it allows you to manage your blog by going to yourapp.com/admin. It uses devise to create an Admin user (you can specify a diferent model name than user to not to mix it with the users from omniauth or from your other app) and if you have the right models and associations between them you can from there create your posts, assign them tags or categories and also delete comments etc.. its all done in an easy way. For the Text Area that you use to introduce the content of your posts you can associate it with the ckeditor just by adding to the rails_admin initializer something like:
config.model Post do
edit do
field :body, :text do
ckeditor true
end
end
end