On Thursday, February 1, 2018 at 2:30:07 AM UTC-5, fugee ohu wrote:
I'm having find_or_create_by roll back on me in the console directly from the model I'm not providing an id, the mysql id column is autoincrementModel.find_or_create_by(person_id: 1, picture_id:37)
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e662ef65-e157-45eb-83ce-f92cfe05ab0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Thursday, February 1, 2018 at 2:30:07 AM UTC-5, fugee ohu wrote:
I'm having find_or_create_by roll back on me in the console directly from the model I'm not providing an id, the mysql id column is autoincrementModel.find_or_create_by(person_id: 1, picture_id:37)
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ae69497b-26ac-4838-a853-4b11f87a35df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/db326225-a0e5-4341-8dd2-bea740e5791e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/99655628-bb4c-441f-8216-11958cde8819%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi,
On Thursday, May 13, 2010 at 2:37:05 PM UTC+5:30, Vladimir Rybas wrote:
Hi all,
Is there any gem or plugin available for Users Actions Logging?
User can create, view, chage, delete some Model and other users should
be available to see the logs.
I'm ready to use some kind of observers on models, to write Events to
database.
And second question:
Should I store all Events in database? Or YAML files or something
would be preferred?
You thoughs, guys
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com .
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com .
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en .
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/235870d6-8d1a-414a-9346-1a460db85af5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Thursday, October 12, 2017 at 7:17:04 AM UTC-7, der_tom wrote:
hi,i am using ransack and i am experiencing slow queries, eg on the search sites i have a query like that:SELECT DISTINCT COUNT(DISTINCT `tablename`.`id`) FROM `tablename` WHERE (`tablename`.`city` LIKE '%Tampa%');~5secw/o distinct~ 6secw/o distinct & w/o where~4 secwhat do you guys do? i reviewed all indexes, datatypes, memory is ok. no overload.and yet i am feeling that i am missing something....thx
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d47efafc-ab5d-4965-aeaa-13b870d7ea8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a0573738-f970-4447-91be-759f4fa33b04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
thank you
--
There's this setting (in "config/environments/test.rb" for test env):
config.action_controller.allow_forgery_protection = false (default for test env)
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/06ff2a24-229c-431e-aed9-06f5019ed8aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hello,I've read the rails introduction and followed the examples. It was quite understandable. But the form validation didn't work as expected.My form begins with<%= form_with(model: @article) do |form| %><% if @article.errors.any? %>...and in the class is the validation rule:validates :title, length: { minimum: 5 }...part of the controller:def update@article = Article.find(params[:id])if @article.update(article_params)redirect_to @articleelserender :editendendthe problem is:if the title is too short (for example) I can push the update-button but nothing happens. There is no reload of the page at all, no errors are shown. Is the title is long enough, the submit-button works correctly. Do I change the form_with to (scope: :article, ...) then the errors are shown.I use Rails 5.1.4Thx for a response
--You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.To post to this group, send email to rubyonrails-talk@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/29836bfe-e8ce-4ecc-a1b1-c36bbbc4e599%40googlegroups.com.For more options, visit https://groups.google.com/d/optout.
Hi,
On Mon, Jan 29, 2018, at 23:51, Rob Jonson wrote:
>
> however - what concerns me is that the bug triggered an exception in
> production which was not caught in test.
>
> steps to trigger the bug are
>
> 1) create an account
> 2) log out
> 3) sign in
>
> I test this explicitly in an rspec capybara test using chrome with
> javascript enabled.
> In the test, I don't get the exception.
>
> can anyone explain why?
>
There's this setting (in "config/environments/test.rb" for test env):
config.action_controller.allow_forgery_protection = false (default for test env)
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1517240485.2766764.1251921520.14898AB0%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/29836bfe-e8ce-4ecc-a1b1-c36bbbc4e599%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7423d138-4858-424b-9f74-4ac743f69b43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d3b35d14-bf4d-432e-bd1f-6f9258a3eded%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/79e6a524-bfc0-45b1-af28-83bc42c91186%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Saturday, January 27, 2018 at 4:05:20 PM UTC-5, Colin Law wrote:
On 27 January 2018 at 20:59, fugee ohu <fuge...@gmail.com> wrote:
On Saturday, November 3, 2012 at 7:46:47 AM UTC-4, Fahim Patel wrote:
.....You're missing a respond_to do format blockYou realise you are five years late responding to this problem.Colin
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8e1139ca-040a-47fe-a82c-19c02ad4050b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
ERROR: "thor csv" was called with arguments ["-i,", "-m,"] Usage: "thor datashift:import:csv -i, --input=INPUT -m, --model=MODEL"
thor datashift_spree:load:products -i, --input=products_export.csv
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ba086930-ec47-47d8-a68c-703b7bbffc9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Saturday, November 3, 2012 at 7:46:47 AM UTC-4, Fahim Patel wrote:
.....You're missing a respond_to do format block
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsWQjdrATH8z%3DzcAT3Do-r1AZ%2BM-%3DN88NV%2ByObAzxgJZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
On Saturday, November 3, 2012 at 7:46:47 AM UTC-4, Fahim Patel wrote:
Hi all,from last 1 hour i am facing one problem.I have written a code for creating user and show them in index page after save.Code is working perfectly but on index page i am getting all record till second last record saved, but i am not getting current record which is saved.But in database my last record is saved successful.But when i restart the server , than on index page all record come with the last record .I dont know why this all is happening ?Code below######## controller codeclass AdminUsersController < ApplicationControllerdef new@admin = AdminUser.newenddef index@admins = AdminUser.allenddef create@admin = AdminUser.new(params[:admin_user]) if @admin.saveredirect_to admin_users_pathelserender "new"endendend######## new view############<%= form_for @admin do|f|%>First Name<%= f.text_field :first_name%><%= submit_tag"Create"%><% end %>######## index view############<%= @admins%>##############modelnothing in modelHope you all understand the problem .ThanksRegardsFahim Babar Patel
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e5bafa50-f324-4a7f-b735-abf362d60543%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/be8b1d81-a845-458b-b8a6-d324a5c38542%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3c7f3cd2-217d-4205-bd5e-ef332d1650f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
A mounta
--You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/22e8164a-9a97-4078-b50d-9940d488fb96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/34b8b39a-0c66-4e6a-a1c6-3a8841b983a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Saturday, November 3, 2012 at 7:46:47 AM UTC-4, Fahim Patel wrote:
Hi all,from last 1 hour i am facing one problem.I have written a code for creating user and show them in index page after save.Code is working perfectly but on index page i am getting all record till second last record saved, but i am not getting current record which is saved.But in database my last record is saved successful.But when i restart the server , than on index page all record come with the last record .I dont know why this all is happening ?Code below######## controller codeclass AdminUsersController < ApplicationControllerdef new@admin = AdminUser.newenddef index@admins = AdminUser.allenddef create@admin = AdminUser.new(params[:admin_user]) if @admin.saveredirect_to admin_users_pathelserender "new"endendend######## new view############<%= form_for @admin do|f|%>First Name<%= f.text_field :first_name%><%= submit_tag"Create"%><% end %>######## index view############<%= @admins%>##############modelnothing in modelHope you all understand the problem .ThanksRegardsFahim Babar Patel
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/55272766-6bcb-4d2b-8e29-65853ec113fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Sunday, August 30, 2015 at 8:55:17 AM UTC-4, Sadaf Noor wrote:
Are you facing any problem deploying your app with engine? I had blogit engine in my rails app and there was nothing special about it. I just did following and it worked:$ heroku run bundler install
$ git push heroku master2015-08-30 16:26 GMT+06:00 L. Johan Nissen <lj.n...@googlemail.com>:Hi guys,--
I've got a Rails app that is dependent on a Rails Engine to function. I would like know how to deploy such an app to Heroku and especially if there's somebody who has made a tutorial.
Thank you in advance.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com .
To post to this group, send email to rubyonra...@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ .f24fab7e-ad14-480b-8508- d9a615103fd6%40googlegroups. com
For more options, visit https://groups.google.com/d/optout .
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b7eb9c1d-18d4-4afd-814e-3c9ac6d0cbc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Friday, January 26, 2018 at 12:51:06 PM UTC-5, Walter Lee Davis wrote:
> On Jan 26, 2018, at 12:36 PM, fugee ohu <fuge...@gmail.com> wrote:
>
>
>
> On Friday, January 26, 2018 at 9:06:47 AM UTC-5, Walter Lee Davis wrote:
>
> > On Jan 25, 2018, at 8:41 PM, fugee ohu <fuge...@gmail.com> wrote:
> >
> > Unless i'm gonna show my ads on their pages what can my user's users do for me in a multi tenant multi user blog in terms of monetizing
>
> The whole point of software as a service is that your users pay you to be on your platform. Ads don't enter into it. You provide a full-featured set of tools for blogging, and they pay you for the convenience of using it. You improve that service over time, and they continue to pay you for it.
>
> One of the features you may provide is a one-click way to add ads to *their* blog, and choose which ads are appropriate for *their* audience. If you write that tool, and make it easy to use (and profitable for *your* users), then they will continue to pay you for the privilege of using your platform. Ideally, you should not be getting any bit of their ad revenue (except some transaction fee, if you manage the money for them). Neither should you be putting your ads (which make sense for you) into their blog (which you have never even seen, so how could you find appropriate ads?).
>
> If you do this right, then your users will make more money in ads (or at least break even) than they pay you for the service (or at least break even). If you have priced your service correctly, then your customers will not feel as though they are being ripped off, and will think that the price they pay for the convenience is worthwhile.
>
> Walter
>
> To get money from users I'd do a different type of site like an auction, marketplace or ecommerce site I don't expect anyone to pay me to use a blogging platform Do tumblr users pay for the service or get it free?
I don't know. It's just that when you start talking about multi-tenant software, my mind goes to other problems that pattern solves, which all tend to be pay-to-use.
If you want to make a Tumblr clone, then you could just add a wrapper layout around all published blogs, and your ads would appear there. Depending on how you structure your layout and templates, that could mean header, footer, skyscrapers, almost anything except inserted within the body of the user's content. And if you control the rendering, I suppose you could even break out their content by major blocks (paragraphs, sections, whatever they use to divide their content) and insert an ad every N of those. Nokogiri is how I would do that.
How invasive you get here has to do with what sort of "free" your users are willing to put up with, I would say. If Tumblr adds a header and footer ad, and doesn't share the revenue, then that's one kind. YouTube lets content creators monetize in various ways, some of which they share with the creators, and some of which they don't, including popover ads and other nastiness that I keep removing with browser plugins. 8-)
If you write the blogging engine yourself, then you have access to all of these parts and can do pretty much whatever you want. If you're trying to coerce a blog-in-a-box gem to do this, then you'll probably have to start by reading all the code to that gem, find out where it gets it layouts and templates and partials from, and start adding those to your parent application one at a time until you find the lever you need. And if you can't get it from there, try raising an issue on that gem's Github project.
Walter
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com .
> To post to this group, send email to rubyonra...@googlegroups.com .
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ .1d83fa66-acbb-413a-b246- 735b5564b2a8%40googlegroups. com
> For more options, visit https://groups.google.com/d/optout .
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/60c72477-34cf-40e6-b6d7-88c74a3e9166%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Friday, January 26, 2018 at 12:51:06 PM UTC-5, Walter Lee Davis wrote:
> On Jan 26, 2018, at 12:36 PM, fugee ohu <fuge...@gmail.com> wrote:
>
>
>
> On Friday, January 26, 2018 at 9:06:47 AM UTC-5, Walter Lee Davis wrote:
>
> > On Jan 25, 2018, at 8:41 PM, fugee ohu <fuge...@gmail.com> wrote:
> >
> > Unless i'm gonna show my ads on their pages what can my user's users do for me in a multi tenant multi user blog in terms of monetizing
>
> The whole point of software as a service is that your users pay you to be on your platform. Ads don't enter into it. You provide a full-featured set of tools for blogging, and they pay you for the convenience of using it. You improve that service over time, and they continue to pay you for it.
>
> One of the features you may provide is a one-click way to add ads to *their* blog, and choose which ads are appropriate for *their* audience. If you write that tool, and make it easy to use (and profitable for *your* users), then they will continue to pay you for the privilege of using your platform. Ideally, you should not be getting any bit of their ad revenue (except some transaction fee, if you manage the money for them). Neither should you be putting your ads (which make sense for you) into their blog (which you have never even seen, so how could you find appropriate ads?).
>
> If you do this right, then your users will make more money in ads (or at least break even) than they pay you for the service (or at least break even). If you have priced your service correctly, then your customers will not feel as though they are being ripped off, and will think that the price they pay for the convenience is worthwhile.
>
> Walter
>
> To get money from users I'd do a different type of site like an auction, marketplace or ecommerce site I don't expect anyone to pay me to use a blogging platform Do tumblr users pay for the service or get it free?
I don't know. It's just that when you start talking about multi-tenant software, my mind goes to other problems that pattern solves, which all tend to be pay-to-use.
If you want to make a Tumblr clone, then you could just add a wrapper layout around all published blogs, and your ads would appear there. Depending on how you structure your layout and templates, that could mean header, footer, skyscrapers, almost anything except inserted within the body of the user's content. And if you control the rendering, I suppose you could even break out their content by major blocks (paragraphs, sections, whatever they use to divide their content) and insert an ad every N of those. Nokogiri is how I would do that.
How invasive you get here has to do with what sort of "free" your users are willing to put up with, I would say. If Tumblr adds a header and footer ad, and doesn't share the revenue, then that's one kind. YouTube lets content creators monetize in various ways, some of which they share with the creators, and some of which they don't, including popover ads and other nastiness that I keep removing with browser plugins. 8-)
If you write the blogging engine yourself, then you have access to all of these parts and can do pretty much whatever you want. If you're trying to coerce a blog-in-a-box gem to do this, then you'll probably have to start by reading all the code to that gem, find out where it gets it layouts and templates and partials from, and start adding those to your parent application one at a time until you find the lever you need. And if you can't get it from there, try raising an issue on that gem's Github project.
Walter
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com .
> To post to this group, send email to rubyonra...@googlegroups.com .
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ .1d83fa66-acbb-413a-b246- 735b5564b2a8%40googlegroups. com
> For more options, visit https://groups.google.com/d/optout .
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/457d302b-5960-44da-8fa5-3a29600966c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Friday, January 26, 2018 at 6:36:50 PM UTC+5:30, Prince Bansal wrote:
Hello Guys,I faced a situation in Rails that I need current_user method inside model. There is a condition that I do not have any column that is associatedwith current_user in model. I do not want to declare virtual attribute in each activerecord model also do not want to set it in global variable. How can I achieve this?Your help will be highly appreciated.Thanks.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3b7660ee-b789-4fbb-b9ea-55dd943c8061%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
> On Jan 26, 2018, at 12:36 PM, fugee ohu <fugee279@gmail.com> wrote:
>
>
>
> On Friday, January 26, 2018 at 9:06:47 AM UTC-5, Walter Lee Davis wrote:
>
> > On Jan 25, 2018, at 8:41 PM, fugee ohu <fuge...@gmail.com> wrote:
> >
> > Unless i'm gonna show my ads on their pages what can my user's users do for me in a multi tenant multi user blog in terms of monetizing
>
> The whole point of software as a service is that your users pay you to be on your platform. Ads don't enter into it. You provide a full-featured set of tools for blogging, and they pay you for the convenience of using it. You improve that service over time, and they continue to pay you for it.
>
> One of the features you may provide is a one-click way to add ads to *their* blog, and choose which ads are appropriate for *their* audience. If you write that tool, and make it easy to use (and profitable for *your* users), then they will continue to pay you for the privilege of using your platform. Ideally, you should not be getting any bit of their ad revenue (except some transaction fee, if you manage the money for them). Neither should you be putting your ads (which make sense for you) into their blog (which you have never even seen, so how could you find appropriate ads?).
>
> If you do this right, then your users will make more money in ads (or at least break even) than they pay you for the service (or at least break even). If you have priced your service correctly, then your customers will not feel as though they are being ripped off, and will think that the price they pay for the convenience is worthwhile.
>
> Walter
>
> To get money from users I'd do a different type of site like an auction, marketplace or ecommerce site I don't expect anyone to pay me to use a blogging platform Do tumblr users pay for the service or get it free?
I don't know. It's just that when you start talking about multi-tenant software, my mind goes to other problems that pattern solves, which all tend to be pay-to-use.
If you want to make a Tumblr clone, then you could just add a wrapper layout around all published blogs, and your ads would appear there. Depending on how you structure your layout and templates, that could mean header, footer, skyscrapers, almost anything except inserted within the body of the user's content. And if you control the rendering, I suppose you could even break out their content by major blocks (paragraphs, sections, whatever they use to divide their content) and insert an ad every N of those. Nokogiri is how I would do that.
How invasive you get here has to do with what sort of "free" your users are willing to put up with, I would say. If Tumblr adds a header and footer ad, and doesn't share the revenue, then that's one kind. YouTube lets content creators monetize in various ways, some of which they share with the creators, and some of which they don't, including popover ads and other nastiness that I keep removing with browser plugins. 8-)
If you write the blogging engine yourself, then you have access to all of these parts and can do pretty much whatever you want. If you're trying to coerce a blog-in-a-box gem to do this, then you'll probably have to start by reading all the code to that gem, find out where it gets it layouts and templates and partials from, and start adding those to your parent application one at a time until you find the lever you need. And if you can't get it from there, try raising an issue on that gem's Github project.
Walter
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1d83fa66-acbb-413a-b246-735b5564b2a8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/54205CCA-8743-438A-ABD2-DEBDA0871216%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
> On Jan 26, 2018, at 12:36 PM, Prince Bansal <er.princebansal@gmail.com> wrote:
>
> Okay. You're not going to be able to access current_user in a model like this. There's just no notion of who is using the app in the Model context. In a controller or view, yes, you can do this (although I would recommend you use CanCanCan or Pundit to abstract the authorization away into its own domain).
>
> - There are two type of users updating this record. One with admin permission and another with area_admin. But in case of area admin I also need to check that record should not be older than 7 days. I am already using pundit for authorization.
>
> You want to think about this from the perspective of can_edit? rather than is_editable?. The former works on a user, which the controller or view would know about. The latter is specific to the instance of the model -- has it had the "publish" checkbox clicked? has an admin approved it? etc.
>
> I suspect you will keep your is_editable? method (without the user-specific stuff) and then add on to that with a can_edit? method that may in fact also invoke the is_editable? method from its target.
>
> - It means I need to remove before_save callback and simply keep is_editable method and invoke it on target object with can_edit? in controller? Right?
That could work. Another way to do this is to loop it into a validation. can_edit? could govern whether the edit button appears in the view, but if you added it to the validations, then it could also keep you from saving a record you shouldn't if you somehow manage to get the form to load (by hacking the path).
Walter
>
> On Friday, January 26, 2018 at 6:36:50 PM UTC+5:30, Prince Bansal wrote:
> Hello Guys,
>
> I faced a situation in Rails that I need current_user method inside model. There is a condition that I do not have any column that is associated
> with current_user in model. I do not want to declare virtual attribute in each activerecord model also do not want to set it in global variable. How can I achieve this?
>
> Your help will be highly appreciated.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7c51e795-9593-47d9-a3c6-99b3cc6c8cbc%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/471BC3D5-648A-4C22-96B3-E5A9E61DEE25%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
You want to think about this from the perspective of can_edit? rather than is_editable?. The former works on a user, which the controller or view would know about. The latter is specific to the instance of the model -- has it had the "publish" checkbox clicked? has an admin approved it? etc.
I suspect you will keep your is_editable? method (without the user-specific stuff) and then add on to that with a can_edit? method that may in fact also invoke the is_editable? method from its target.
On Friday, January 26, 2018 at 6:36:50 PM UTC+5:30, Prince Bansal wrote:
Hello Guys,I faced a situation in Rails that I need current_user method inside model. There is a condition that I do not have any column that is associatedwith current_user in model. I do not want to declare virtual attribute in each activerecord model also do not want to set it in global variable. How can I achieve this?Your help will be highly appreciated.Thanks.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7c51e795-9593-47d9-a3c6-99b3cc6c8cbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Friday, January 26, 2018 at 9:06:47 AM UTC-5, Walter Lee Davis wrote:
> On Jan 25, 2018, at 8:41 PM, fugee ohu <fuge...@gmail.com> wrote:
>
> Unless i'm gonna show my ads on their pages what can my user's users do for me in a multi tenant multi user blog in terms of monetizing
The whole point of software as a service is that your users pay you to be on your platform. Ads don't enter into it. You provide a full-featured set of tools for blogging, and they pay you for the convenience of using it. You improve that service over time, and they continue to pay you for it.
One of the features you may provide is a one-click way to add ads to *their* blog, and choose which ads are appropriate for *their* audience. If you write that tool, and make it easy to use (and profitable for *your* users), then they will continue to pay you for the privilege of using your platform. Ideally, you should not be getting any bit of their ad revenue (except some transaction fee, if you manage the money for them). Neither should you be putting your ads (which make sense for you) into their blog (which you have never even seen, so how could you find appropriate ads?).
If you do this right, then your users will make more money in ads (or at least break even) than they pay you for the service (or at least break even). If you have priced your service correctly, then your customers will not feel as though they are being ripped off, and will think that the price they pay for the convenience is worthwhile.
Walter
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1d83fa66-acbb-413a-b246-735b5564b2a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Okay. You're not going to be able to access current_user in a model like this. There's just no notion of who is using the app in the Model context. In a controller or view, yes, you can do this (although I would recommend you use CanCanCan or Pundit to abstract the authorization away into its own domain).
You want to think about this from the perspective of can_edit? rather than is_editable?. The former works on a user, which the controller or view would know about. The latter is specific to the instance of the model -- has it had the "publish" checkbox clicked? has an admin approved it? etc.
I suspect you will keep your is_editable? method (without the user-specific stuff) and then add on to that with a can_edit? method that may in fact also invoke the is_editable? method from its target.
Walter
> On Jan 26, 2018, at 11:26 AM, Prince Bansal <er.princebansal@gmail.com> wrote:
>
> Here is the code snippet.
>
> class Attendance < ApplicationRecord
>
> ATTENDANCE_EDITABLE_VALIDITY = 7
>
> before_save :is_editable?
>
> belongs_to :attendance_detail
>
> def is_editable?
> errors.add(:attendance, 'modification is not allowed.') if attendance_detail.created_at.present? && (Time.zone.now.to_date - attendance_detail.created_at.to_date).to_i >= ATTENDANCE_EDITABLE_VALIDITY unless current_user.super_admin? || current_user.admin?
> errors.empty?
> end
> end
>
> I have lots of conditional callbacks based on current_user in AR.
> I do not want to move these conditions in controller. As there are lot of other conditions that are user permission specific.
>
>
> On Friday, January 26, 2018 at 6:36:50 PM UTC+5:30, Prince Bansal wrote:
> Hello Guys,
>
> I faced a situation in Rails that I need current_user method inside model. There is a condition that I do not have any column that is associated
> with current_user in model. I do not want to declare virtual attribute in each activerecord model also do not want to set it in global variable. How can I achieve this?
>
> Your help will be highly appreciated.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/06d886de-2b66-46ac-b71d-7d37981a194a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5B816BC0-5A36-4BA7-B695-D0628FDF797E%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
class Attendance < ApplicationRecord
ATTENDANCE_EDITABLE_VALIDITY = 7
before_save :is_editable?
belongs_to :attendance_detail
def is_editable? errors.add(:attendance, 'modification is not allowed.') if attendance_detail.created_at.present? && (Time.zone.now.to_date - attendance_detail.created_at.to_date).to_i >= ATTENDANCE_EDITABLE_VALIDITY unless current_user.super_admin? || current_user.admin? errors.empty? endend
On Friday, January 26, 2018 at 6:36:50 PM UTC+5:30, Prince Bansal wrote:
Hello Guys,I faced a situation in Rails that I need current_user method inside model. There is a condition that I do not have any column that is associatedwith current_user in model. I do not want to declare virtual attribute in each activerecord model also do not want to set it in global variable. How can I achieve this?Your help will be highly appreciated.Thanks.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/06d886de-2b66-46ac-b71d-7d37981a194a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Devise is written to be model name agnostic. They use the reference name `resource` internally to mean User, Admin, ChiefPoobah, Peasant -- whatever you choose to call your user model. If you're not hacking on Devise, then you may need to look for a similar abstraction in what you are working on. More details would help us help you...
Walter
> On Jan 26, 2018, at 8:20 AM, Rodrigo Urubatan Ferreira Jardim <urubatan@gmail.com> wrote:
>
> Current user is a session concept, are you sure you are doing things in the correct place?
>
> Maybe you are doing something in a active record hook that should be a method called by the controller...
>
>
> Em Sex, 26 de jan de 2018 11:06, Prince Bansal <er.princebansal@gmail.com> escreveu:
> Hello Guys,
>
> I faced a situation in Rails that I need current_user method inside model. There is a condition that I do not have any column that is associated
> with current_user in model. I do not want to declare virtual attribute in each activerecord model also do not want to set it in global variable. How can I achieve this?
>
> Your help will be highly appreciated.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0bc3a8c2-8d47-4cea-b6f0-3cedd760a15c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Rodrigo Urubatan Ferreira Jardim
> urubatan@gmail.com / rodrigo@urubatan.com.br
> http://www.urubatan.com.br
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAEi2OX6ZmGSM_KbKJqZBypN-M22gwTouFgCu8zFoX%3Ds1BbDibw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/63CE8353-D850-47EF-942C-5131F86B7440%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
Right. It's even easier for a gem. Just put your templates in the same relative place within your normal rails views or controllers, properly named, and they will "shadow" the version within the gem. In most things in Rails, "nearest wins". Gems insert their code into the Rails lookup path *after* the core application code, not before. So if you add code to the core, it will be found before the gem's code is, and Rails will stop looking at that point.
I just dealt with this last night, when I overrode the Thredded gem to make the breadcrumbs work the way I needed them to. All I had to do was add this folder:
app/views/thredded/shared
and add the _breadcrumbs.html.erb file to that folder, and I had complete control over that one file (without needing to shadow every other part of the gem).
Walter
> On Jan 26, 2018, at 7:10 AM, Mauro Locatelli <crivotz@gmail.com> wrote:
>
> Sorry I've seen now the word 'gems'
> My instructions are to make override of scaffold generator.
>
> Mauro
>
>
> 2018-01-26 13:06 GMT+01:00 Mauro Locatelli <crivotz@gmail.com>:
> Yes, you can
>
> Model
> project_folder/lib/templates/active_record/model/model.rb
>
> Controller
> project_folder/lib/templates/rails/scaffold_controller/controller.rb
>
> Views
> project_folder/lib/templates/erb/scaffold/
>
> All the original file can be founded inside railties folder (bundle show railties)
> You can also add views editing scaffold_generator.rb
>
> Cheers
> Mauro
>
> 2018-01-26 12:52 GMT+01:00 fugee ohu <fugee279@gmail.com>:
> I can override any gem's controllers and views by creating them in my app?
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/51d6633b-81cc-41ef-b548-575feb06f086%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CANnJYrqXiWCGi8yayXi4OCJSRxq_D4m6Er8fzBbPjf7Ak4%2BuVw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9B5539DE-AE7E-499C-88F4-7DB7B89B7925%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.