Sent from my iPhone
Dear Colin,--
I think that what you are broaching is an ethical matter in the use of this Talk Group. Generally folks cheating, as students or incompetent employees.
Where and when does one choose not to help.
Liz
On Monday, August 31, 2015 at 4:45:13 PM UTC-4, Colin Law wrote:On 31 August 2015 at 18:29, prabhu <pradeep....@gmail.com> wrote:
> Hi Colin,
>
> First of all Sorry for neglecting the previous comments. I didnt notice that
> i had reply for the previous posts which I posted. Thats the reason I posted
> it once again here.
> Thanks for your suggestions.
I notice, looking back through your previous posts over more than a
year you have rarely responded to replies here.
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/d7302059-8361-47e8-93eb-19b658e8468a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I think that what you are broaching is an ethical matter in the use of this Talk Group. Generally folks cheating, as students or incompetent employees.
Where and when does one choose not to help.
Liz
On Monday, August 31, 2015 at 4:45:13 PM UTC-4, Colin Law wrote:
On 31 August 2015 at 18:29, prabhu <pradeep....@gmail.com> wrote:
> Hi Colin,
>
> First of all Sorry for neglecting the previous comments. I didnt notice that
> i had reply for the previous posts which I posted. Thats the reason I posted
> it once again here.
> Thanks for your suggestions.
I notice, looking back through your previous posts over more than a
year you have rarely responded to replies here.
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/d7302059-8361-47e8-93eb-19b658e8468a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Monday, August 31, 2015 at 12:46:53 AM UTC-7, Colin Law wrote:
On 30 August 2015 at 23:27, venu madhav chitta
<venu.ch...@gmail.com> wrote:
> No they just use existing tables, do some joins and generate the item
> recommendations. Their interface looks like: recommendations(user_id) and
> returns [item_id]
First if you are using joins manually then it may be that you have
specified the associations incorrectly as it should only rarely be
necessary to specify the joins. In addition you said in the original
post that you were using sql to query, this is almost certainly not
right unless you are doing something rather complex that the rails
activerecord interface will not handle. If you want advice on that
then ask a separate question showing the query you are performing.
So if I understand correctly you have some code that references
several tables but it does not seem appropriate to just put the code
inside one of the models. In such situations I would either make it a
model which is not derived from ActiveRecord or put it in a module in
lib. Whichever seems most appropriate. Probable a model in your
case. Don't get stressed over exactly where you put things however,
there are no hard rules, just do whatever seems most appropriate for
your case.
Colin
>
> On Sunday, August 30, 2015 at 1:03:20 AM UTC-7, Colin Law wrote:
>>
>> On 30 August 2015 at 04:36, venu madhav chitta
>> <venu.ch...@gmail.com> wrote:
>> > I am implementing strategy pattern in Rails where I have Models like
>> > User,
>> > Item, Category and need to recommend items for the users depending on
>> > various algorithms (strategies) that user selects in view.
>> >
>> > I am having a Recommend class which has an interface of
>> > recommend(user_id,
>> > strategy) and returns array of item_id. The strategy in recommend will
>> > be
>> > decided at runtime depending on the option user selects in the view. I
>> > have
>> > placed the recommend interface in /lib directory and the strategies in
>> > /lib/strategy directory. The strategies or algorithms right now will do
>> > SQL
>> > queries to give recommendations which is naive.
>> >
>> > I want to make sure if I placed the files in proper directories or
>> > Should I
>> > need place the recommend class and all the strategies in models or
>> > app/services or any other?. I am really confused.
>>
>> Are there database tables behind the recommend and strategy code or
>> are they just code?
>> You say there are Items but have not told us what an Item is.
>>
>> 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-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/ .c9c746c9-2957-49a3-a9ba- f52aa7ae61ec%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/6fca372f-4193-4e41-842c-2e2d1c000090%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/05ed163f-abcf-48ab-aa9a-82dfd8c9fb54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On 31 August 2015 at 18:29, prabhu <pradeep.achuthan@gmail.com> wrote:
> Hi Colin,
>
> First of all Sorry for neglecting the previous comments. I didnt notice that
> i had reply for the previous posts which I posted. Thats the reason I posted
> it once again here.
> Thanks for your suggestions.
I notice, looking back through your previous posts over more than a
year you have rarely responded to replies here.
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/CAL%3D0gLuX8eXPyTnuPW-VurQkvsuzxeCH7d1HFATN89NYh2uKrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
On 31 August 2015 at 19:12, John Lahr <johnelahr@gmail.com> wrote:
> I would look into the concept of a single table inheritance for a
> transactions table...you'd have to add an extra attribute/column that would
> be 'transaction' type to indicate whether it's an expense or income, but
> this should be able to be done with a simple 1 to many relationship - a user
> has many transactions - Single Table Inheritance is great for things like
> this and Rails handles it very easily.
Whether the added complication of STI is worth the benefits in this
case depends on what code differences there are between income and
expenses. I would start off with the simple solution and if it
becomes apparent that STI would be beneficial then refactor it at that
point.
Colin
>
> On Monday, August 31, 2015 at 7:47:26 AM UTC-7, Pradeep Achuthan wrote:
>>
>> Hi,
>>
>> I am building an expense tracker application and I am in middle of data
>> modelling. I have a Users table. Each user will log his expenses with
>> expense type and income with income type. So I need to know how can we set
>> up associations for it.
>>
>> I have User, Expense, Income and UserTransaction models.
>>
>> Expense and Income will have following fields
>>
>> id, date, category, amount, description, user_id, currency
>>
>> I am not sure whether I need UserTransaction table also.
>> But my business requirement is as follows
>>
>> I should be able to get all expenses/income of a user with date range and
>> also with category
>>
>> I should also be able to get all transactions occurred with date range.
>
> --
> 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/b17f15cb-fbe5-47c8-be72-c369ba8ae0d6%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/CAL%3D0gLv4OJVRzrwjBvPKkzkBmkqvuODUAcmdF0UJmWCLLHcK7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
On 31 August 2015 at 18:29, prabhu <pradeep.achuthan@gmail.com> wrote:
> Hi Colin,
>
> First of all Sorry for neglecting the previous comments. I didnt notice that
> i had reply for the previous posts which I posted. Thats the reason I posted
> it once again here.
> Thanks for your suggestions.
>
> BTW I was thinking whether polymorphic association would really be nice for
> my scenario
Why? What advantage would that have over the simple setup I suggested?
Colin
>
> On Monday, 31 August 2015 20:17:26 UTC+5:30, Pradeep Achuthan wrote:
>>
>> Hi,
>>
>> I am building an expense tracker application and I am in middle of data
>> modelling. I have a Users table. Each user will log his expenses with
>> expense type and income with income type. So I need to know how can we set
>> up associations for it.
>>
>> I have User, Expense, Income and UserTransaction models.
>>
>> Expense and Income will have following fields
>>
>> id, date, category, amount, description, user_id, currency
>>
>> I am not sure whether I need UserTransaction table also.
>> But my business requirement is as follows
>>
>> I should be able to get all expenses/income of a user with date range and
>> also with category
>>
>> I should also be able to get all transactions occurred with date range.
>
> --
> 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/f4439ded-0ae6-4f4f-b85b-499ab02c8450%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/CAL%3D0gLuHe0cVGcPk64Yt2U5ed0C9m22caZ0tYfqMSw6244keYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
On Monday, August 31, 2015 at 7:47:26 AM UTC-7, Pradeep Achuthan wrote:
Hi,
I am building an expense tracker application and I am in middle of data modelling. I have a Users table. Each user will log his expenses with expense type and income with income type. So I need to know how can we set up associations for it.
I have User, Expense, Income and UserTransaction models.
Expense and Income will have following fields
id, date, category, amount, description, user_id, currency
I am not sure whether I need UserTransaction table also.
But my business requirement is as follows
I should be able to get all expenses/income of a user with date range and also with category
I should also be able to get all transactions occurred with date range.
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/b17f15cb-fbe5-47c8-be72-c369ba8ae0d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
First of all Sorry for neglecting the previous comments. I didnt notice that i had reply for the previous posts which I posted. Thats the reason I posted it once again here.
Thanks for your suggestions.
BTW I was thinking whether polymorphic association would really be nice for my scenario
On Monday, 31 August 2015 20:17:26 UTC+5:30, Pradeep Achuthan wrote:
Hi,
I am building an expense tracker application and I am in middle of data modelling. I have a Users table. Each user will log his expenses with expense type and income with income type. So I need to know how can we set up associations for it.
I have User, Expense, Income and UserTransaction models.
Expense and Income will have following fields
id, date, category, amount, description, user_id, currency
I am not sure whether I need UserTransaction table also.
But my business requirement is as follows
I should be able to get all expenses/income of a user with date range and also with category
I should also be able to get all transactions occurred with date range.
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/f4439ded-0ae6-4f4f-b85b-499ab02c8450%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On 31 August 2015 at 15:47, Pradeep Achuthan <pradeep83.achu@gmail.com> wrote:
I notice that the last time you asked basically the same question you
did not appear to reply or offer thanks for the help offered, which is
not good manners, unless I missed the post. However I will try to
help again. See below,
> Hi,
>
> I am building an expense tracker application and I am in middle of data
> modelling. I have a Users table. Each user will log his expenses with
> expense type and income with income type. So I need to know how can we set
> up associations for it.
>
> I have User, Expense, Income and UserTransaction models.
>
> Expense and Income will have following fields
>
> id, date, category, amount, description, user_id, currency
There is a big clue there. If two tables have the same fields then
almost certainly it should just be one table. Possibly call it
transactions and use different categories to distinguish between
income and expenses.
>
> I am not sure whether I need UserTransaction table also.
> But my business requirement is as follows
>
> I should be able to get all expenses/income of a user with date range and
> also with category
>
> I should also be able to get all transactions occurred with date range.
I also don't see any need for a UserTransaction table. I think you
just need User has_many transactions, Transaction belongs_to user.
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/CAL%3D0gLtOuA-ASvoV8umXL4wiodA1xu835A-E1HHWapuO%2BsJE_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
I am building an expense tracker application and I am in middle of data modelling. I have a Users table. Each user will log his expenses with expense type and income with income type. So I need to know how can we set up associations for it.
I have User, Expense, Income and UserTransaction models.
Expense and Income will have following fields
id, date, category, amount, description, user_id, currency
I am not sure whether I need UserTransaction table also.
But my business requirement is as follows
I should be able to get all expenses/income of a user with date range and also with category
I should also be able to get all transactions occurred with date range.
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/acdfc028-d03d-41b5-b912-7afff1079032%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Am Sonntag, 30. August 2015 14:08:04 UTC+2 schrieb L. Johan Nissen:
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-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/729e09c5-1626-4210-82e5-ff62b7c464fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On 30 August 2015 at 23:27, venu madhav chitta
<venu.chitta1992@gmail.com> wrote:
> No they just use existing tables, do some joins and generate the item
> recommendations. Their interface looks like: recommendations(user_id) and
> returns [item_id]
First if you are using joins manually then it may be that you have
specified the associations incorrectly as it should only rarely be
necessary to specify the joins. In addition you said in the original
post that you were using sql to query, this is almost certainly not
right unless you are doing something rather complex that the rails
activerecord interface will not handle. If you want advice on that
then ask a separate question showing the query you are performing.
So if I understand correctly you have some code that references
several tables but it does not seem appropriate to just put the code
inside one of the models. In such situations I would either make it a
model which is not derived from ActiveRecord or put it in a module in
lib. Whichever seems most appropriate. Probable a model in your
case. Don't get stressed over exactly where you put things however,
there are no hard rules, just do whatever seems most appropriate for
your case.
Colin
>
> On Sunday, August 30, 2015 at 1:03:20 AM UTC-7, Colin Law wrote:
>>
>> On 30 August 2015 at 04:36, venu madhav chitta
>> <venu.ch...@gmail.com> wrote:
>> > I am implementing strategy pattern in Rails where I have Models like
>> > User,
>> > Item, Category and need to recommend items for the users depending on
>> > various algorithms (strategies) that user selects in view.
>> >
>> > I am having a Recommend class which has an interface of
>> > recommend(user_id,
>> > strategy) and returns array of item_id. The strategy in recommend will
>> > be
>> > decided at runtime depending on the option user selects in the view. I
>> > have
>> > placed the recommend interface in /lib directory and the strategies in
>> > /lib/strategy directory. The strategies or algorithms right now will do
>> > SQL
>> > queries to give recommendations which is naive.
>> >
>> > I want to make sure if I placed the files in proper directories or
>> > Should I
>> > need place the recommend class and all the strategies in models or
>> > app/services or any other?. I am really confused.
>>
>> Are there database tables behind the recommend and strategy code or
>> are they just code?
>> You say there are Items but have not told us what an Item is.
>>
>> 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/c9c746c9-2957-49a3-a9ba-f52aa7ae61ec%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/CAL%3D0gLuQfst00gVt3eFAPRBG8ALjpVx2p_GM%3DgDe97865XFpqQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
On Sunday, August 30, 2015 at 1:03:20 AM UTC-7, Colin Law wrote:
On 30 August 2015 at 04:36, venu madhav chitta
<venu.ch...@gmail.com> wrote:
> I am implementing strategy pattern in Rails where I have Models like User,
> Item, Category and need to recommend items for the users depending on
> various algorithms (strategies) that user selects in view.
>
> I am having a Recommend class which has an interface of recommend(user_id,
> strategy) and returns array of item_id. The strategy in recommend will be
> decided at runtime depending on the option user selects in the view. I have
> placed the recommend interface in /lib directory and the strategies in
> /lib/strategy directory. The strategies or algorithms right now will do SQL
> queries to give recommendations which is naive.
>
> I want to make sure if I placed the files in proper directories or Should I
> need place the recommend class and all the strategies in models or
> app/services or any other?. I am really confused.
Are there database tables behind the recommend and strategy code or
are they just code?
You say there are Items but have not told us what an Item is.
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/c9c746c9-2957-49a3-a9ba-f52aa7ae61ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Sunday, August 30, 2015 at 1:08:04 PM UTC+1, L. Johan Nissen wrote:
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.
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/afaf0507-febe-411e-be90-8c585c221ed2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
$ git push heroku master
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-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/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/CAAJ2eVqUwTEay1DHAcStQgc_KEcPXRz7CG58HGhU5GSy%2Bsf_Kw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
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-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/f24fab7e-ad14-480b-8508-d9a615103fd6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On 30 August 2015 at 04:36, venu madhav chitta
<venu.chitta1992@gmail.com> wrote:
> I am implementing strategy pattern in Rails where I have Models like User,
> Item, Category and need to recommend items for the users depending on
> various algorithms (strategies) that user selects in view.
>
> I am having a Recommend class which has an interface of recommend(user_id,
> strategy) and returns array of item_id. The strategy in recommend will be
> decided at runtime depending on the option user selects in the view. I have
> placed the recommend interface in /lib directory and the strategies in
> /lib/strategy directory. The strategies or algorithms right now will do SQL
> queries to give recommendations which is naive.
>
> I want to make sure if I placed the files in proper directories or Should I
> need place the recommend class and all the strategies in models or
> app/services or any other?. I am really confused.
Are there database tables behind the recommend and strategy code or
are they just code?
You say there are Items but have not told us what an Item is.
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/CAL%3D0gLvkisUyEFPnabZ5-XmOyKB%3D7j4Sjo5ZATgnib3FO1sjZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
I am implementing strategy pattern in Rails where I have Models like User, Item, Category and need to recommend items for the users depending on various algorithms (strategies) that user selects in view.
I am having a Recommend class which has an interface of recommend(user_id, strategy) and returns array of item_id. The strategy in recommend will be decided at runtime depending on the option user selects in the view. I have placed the recommend interface in /lib directory and the strategies in /lib/strategy directory. The strategies or algorithms right now will do SQL queries to give recommendations which is naive.
I want to make sure if I placed the files in proper directories or Should I need place the recommend class and all the strategies in models or app/services or any other?. I am really confused.
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/9e54adf5-deb5-4e25-968c-f1f61cc84e75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On 29 August 2015 at 20:07, Elizabeth McGurty <emcgurty2@gmail.com> wrote:
> What may be more aesthetically pleasing to you is the structure. although I
> am not certain:
>
> before_filter :f2, :only => :show do |c|
> unless c.this.test?
> end
>
>
> Totally not certain about the syntax, but I think that the spirit of what I
> am offering may be helpful
Thanks for the suggestion, but I am not sure how that helps with the
f1 filter and the repeated call of test?()
Colin
>
> Liz
>
> --
> 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/a82fe669-12c2-4014-91b5-ae35d7a70504%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/CAL%3D0gLt5mHKCMS0YdYwYvhZ4p5eJxkS3YuMY%3DWXTSxaKjFo%2B8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
before_filter :f2, :only => :show do |c| unless c.this.test?
end
Totally not certain about the syntax, but I think that the spirit of what I am offering may be helpful
Liz
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/a82fe669-12c2-4014-91b5-ae35d7a70504%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On 29 August 2015 at 16:08, tamouse pontiki <tamouse.lists@gmail.com> wrote:
> can you memoize the result of test? assuming it wouldn't change between
> callbacks? otherwise, write one callback and perform all the tests,
> including the action check for only show inside it?
Yes I could do either of those but neither is aesthetically pleasing,
which is why I wondered whether there was a better solution. Will
probably plump for the first as the second filter would have to be
called something like
f1_unless_test_and_f2_if_show_unless_test
for it to make any sense when read as f1 and f2 are unrelated.
Colin
>
> On Sat, Aug 29, 2015 at 9:09 AM, Colin Law <clanlaw@gmail.com> wrote:
>>
>> Is there a more efficient way of coding this?
>>
>> before_filter :f1, unless: :test?
>> before_filter :f2, only: :show, unless: :test?
>>
>> I don't want to call test? twice as it is not trivial.
>>
>> 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/CAL%3D0gLtXdKNdw%3De8b-Uozdp%2B0f1aruY6Ou21zBhtipL5bnOksA%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/CAHUC_t--QO3H8P51y3BFKECefXdQSaA2dnYX9KXdpRSvtfzAFQ%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/CAL%3D0gLtCC354bW9wCNMUSxZdEK63wGCTnBPMrzeVMWR18nsBXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Is there a more efficient way of coding this?
before_filter :f1, unless: :test?
before_filter :f2, only: :show, unless: :test?
I don't want to call test? twice as it is not trivial.
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/CAL%3D0gLtXdKNdw%3De8b-Uozdp%2B0f1aruY6Ou21zBhtipL5bnOksA%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/CAHUC_t--QO3H8P51y3BFKECefXdQSaA2dnYX9KXdpRSvtfzAFQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Is there a more efficient way of coding this?
before_filter :f1, unless: :test?
before_filter :f2, only: :show, unless: :test?
I don't want to call test? twice as it is not trivial.
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/CAL%3D0gLtXdKNdw%3De8b-Uozdp%2B0f1aruY6Ou21zBhtipL5bnOksA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
I think that you may recognize my name, I have made some decent contributions here. What you may or not know about me is that I am a single parent to an amazing kid. Her high school is in rural Virginia community which has very limited funds toward athletics. Wondering if you guys would support my daughter's Cross-Country Team?
Contact Galileo High School, Danville, VA, either Principal Lancaster or Coach Bryant at jlancast@mail.dps.k12.va.us or mbryant@mail.dps.k12.va.us.
THANKS!
Liz McGurty
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/8f62b771-07ba-483f-b162-1735cbde920a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[Rails] Re: importing .csv file from user and storing data of csv into database using ruby on rails.
On Friday, August 28, 2015 at 10:15:07 AM UTC-4, Elizabeth McGurty wrote:
def import
@question = Question.new ## You have just created a new instance of model class Question
@question.import(params[:file])
redirect_to root_url, notice: "Questions imported succefully."
end
class Question
validates :id, uniqueness: true ## see below
def self.import(file)
CSV.foreach(file.path, headers: true) do |row| ## okay so you will iterate by row
question_hash = row.to_hash
## This is okay, but you should put a watch on row, and understand its structure. In doing so, you may not need to convert row to row.to_hash. Otherwise, you should put a watch on row.to_hash to verify that the
## structure of the 'row' is consistent with your database structure and other matters that may be in your Question model
##@question = Question.where(id: question_hash["id"])
## okay this seems reasonable but at the model level rather than creating a new Question object, you should rather be doing validation on id, see above.
## If I were you I would do validation on the record, not just the id
## if @question.count == 1
##@question.first.update_attributes(question_hash) ## self not new instance of Question
@return_value_on_update_attributes = self.update_attributes( question_hash) ## Read: http://apidock.com/rails/ ActiveRecord/Base/update_ attributes
unless @return_value_on_update_attributes ## unless @return_value_on_update_ attributes is false, eg, if not true
puts "There was an error in record " + question_hash["id"]
puts self.errors.to_yaml ## This way you can continue, and then later you need to check for errors. Of course there are other ways to manage and learn errors. But for now...
end # end unless
end # end foreach
end # end self.import(file)
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/638b60df-6217-409f-a91f-a280a3bc3704%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[Rails] Re: importing .csv file from user and storing data of csv into database using ruby on rails.
@question = Question.new ## You have just created a new instance of model class Question
@question.import(params[:file])
redirect_to root_url, notice: "Questions imported succefully."
end
class Question
validates :id, uniqueness: true ## see below
def self.import(file)
CSV.foreach(file.path, headers: true) do |row| ## okay so you will iterate by row
question_hash = row.to_hash
## This is okay, but you should put a watch on row, and understand its structure. In doing so, you may not need to convert row to row.to_hash. Otherwise, you should put a watch on row.to_hash to verify that the
## structure of the 'row' is consistent with your database structure and other matters that may be in your Question model
##@question = Question.where(id: question_hash["id"])
## okay this seems reasonable but at the model level rather than creating a new Question object, you should rather be doing validation on id, see above.
## If I were you I would do validation on the record, not just the id
## if @question.count == 1
##@question.first.update_attributes(question_hash) ## self not new instance of Question
@return_value_on_update_attributes = self.update_attributes(question_hash) ## Read: http://apidock.com/rails/ActiveRecord/Base/update_attributes
unless @return_value_on_update_attributes ## unless @return_value_on_update_attributes is false, eg, if not true
puts "There was an error in record " + question_hash["id"]
puts self.errors.to_yaml ## This way you can continue, and then later you need to check for errors. Of course there are other ways to manage and learn errors. But for now...
end # end unless
end # end foreach
end # end self.import(file)
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/b49000b7-a94f-4085-8d5f-ba6c50e99069%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/685209ba-87e7-43f0-abb7-4e81ff6ecc07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
We are hiring developers for 3scale's Engineering team in Barcelona.
We are currently focussing on Senior engineers with extensive Rails
experience, but are also interested in applicants with less experience.
If you have any doubts or questions, just ping me directly on andrew at
3scale.net
You can find open positions in Engineering (and Operations also) and
apply directly here: http://www.3scale.net/about/jobs/
Andrew
VP Engineering
Here is a copy of more details from one of those postings to give you an
idea....
3scale's mission is to enable an API driven Web - providing tools and
infrastructure for companies and individuals to open, manage and consume
APIs.
Our tools help people to open their data, publish new services and above
all create new opportunities for innovation / business.
APIs are becoming the lifeblood of the Web - take the chance to help
build some of the tools that are enabling this revolution!
You'll also be joining an awesome team at all levels - from product
innovation to cutting edge engineering.
3scale's Engineering team develops and maintains our API Management
system comprised of traffic control component (pure Ruby) that must be
high-availability, low-latency and high volume. The API Management
Console is a Ruby on Rails application for customers to configure and
manage their APIs through our UI and our APIs.
Technologies involved include Ruby, Ruby-on-Rails, HTML5, CSS3, JS,
ECMA6, jQuery, Sidekiq, REDIS, HAProxy, NGINX, LUA, OpenResty, etc.
Tools and services we use to develop, test, operate and monitor include:
Jenkins, CodeClimate, GitHub, AirBrake, Grafite, Grafana, Kibana, AWS,
Mesos/Marathon, etc.
The position of Senior full-stack developer involves putting your skills
to the test in developing a high performance, high-availability system
with excellent usability. Responsibilities will include leading projects
and/or teams, mentoring more junior developers, working with Product
Management and company management to develop and execute plans for
existing and new product areas.
You:
Have a strong theoretical and practical knowledge of Computer Science,
Languages, Algorithms, and especially technologies involved in
developing a large, complex distributed and web system like ours. Strong
knowledge of HTTP, REST, Authentication, Security, etc.
Have at least 5 years experience developing production applications in a
team environment using the technologies listed above - with special
emphasis on Ruby, Ruby-on-Rails, Front-End Web technologies, Cloud
deployments.
Have worked as part of a larger development team that interacts with
other parts of the organisation such as Product Management, Operations,
Support, etc.
Have excellent written and spoken communications (English), analytical
and problem solving skills.
Are familiar with using git, continuous integration, etc
Have a sense of accountability, commitment to task and quality
Have a willingness to learn from and to teach others
Have experience and ability to plan and prioritise your own work and the
work of others, and experience leading/coordinating a team and mentoring
others
EU citizen or a working permit for the EU
Us:
Cutting edge of the evolution of the Web, our customers are doing new
and exciting things in Web tech and mobile.
Highly motivated multi-cultural team spread across two continents
Barcelona office is in the city centre with a great open space, balcony
and quick access to all the important parts of the city including the
beach
Regular team events, internal presentations and hack events
Salary based on experience and always very competitive
--
Posted via http://www.ruby-forum.com/.
--
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/1d68954be2d0a71f5ed041510910addf%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
[Rails] Re: importing .csv file from user and storing data of csv into database using ruby on rails.
On Monday, 24 August 2015 04:28:12 UTC-4, iampravee...@gmail.com wrote:
Hi friends , I am modifying virtualX open source application. I wanted to introduce new functionality that is uploading questions from .csv file and storing those questions to the database. I am very new to ruby this task becomes very tough for me . So i referred so many websites and blogs and i ready some code for this feature . but this is code is not working . I am getting HTTP 500 error . As i checked code in Aptanan Studio , it is showing some errors.
I am posting my code over here . Please help me friends . I am really not getting what is happening .
I am using Ruby 1.8.7
Rails 3.0.3
questions_controller.rb
def import
@question = Question.new
@question.import(params[:file])
redirect_to root_url, notice: "Questions imported succefully."
end
questions.rb
def self.import(file)
CSV.foreach(file.path, headers: true) do |row|
question_hash = row.to_hash
@question = Question.where(id: question_hash["id"])
if @question.count == 1
@question.first.update_attributes (question_hash)
else
Question.save!(question_hash)
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/8f92e388-a655-4489-aaa1-badd7370a74c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-compatibility/
Liz
On Wednesday, August 26, 2015 at 6:28:42 PM UTC-4, Ruby-Forum.com User wrote:
I'm trying to connect my Rails app to MariaDB cluster.
--
Posted via http://www.ruby-forum.com/.
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/57add772-fb18-49da-ab75-6c74a813fff3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Wednesday, August 26, 2015 at 11:28:42 PM UTC+1, Ruby-Forum.com User wrote:
I'm trying to connect my Rails app to MariaDB cluster.
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/5d48d6f1-60b6-4005-9425-fbe52eabfff6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Tuesday, August 25, 2015 at 10:48:57 PM UTC-4, Leandro França wrote:
Thanks Elizabeth,
From STI, I mean I´m using Single Table Inheritance , since Person and Organization have many fields in common (name, addresses, etc) , but some specific behaviors to be implemented in the future.
The SecondParty just maps the related party association on PartyRelationship. Its is self-referential association.
I´ll check your suggestions on enum field and relationship controller.
Looks like the´ll help.Thanks again,
Leandro2015-08-25 12:19 GMT-03:00 Elizabeth McGurty <emcg...@gmail.com>:ok... I do not know what a 'STI based model' is. And I do not see your SecondParty class here. Pretty sure the matter of second-party can be managed in Party with a field like is_second_party. Don't understand necessity of Classes Organization and Person
Addressing from what I understand:
class Party < ActiveRecord::Base
has_many :party_relationships
scope :organizations, -> { where(type: 'Organization') } ## Haven't tested scope :people, -> { where(type: 'Person') } ## Haven't tested
## one to many party to types
## SQL table parties should contain field 'types'
## rails generate migration add_type_to_parties type:string
## rake db:migrate
## <%= form_for @party .. do |f| %>
## <%= f.collection_select :type, Party::TYPES, :to_s, :humanize %>
TYPES = %w[Organization Person]
end
class PartyRelationship < ActiveRecord::Base
belongs_to :party
## http://edgeapi.rubyonrails.org/classes/ActiveRecord/Enum. html
## Declare an enum attribute where the values map to integers in the database, but can be queried by name. So table PartyRelationship must
## contain field relation
enum relation: [ :customer, :supplier, :employee, :reseller ]
## eg, corresponding database values : 1:customer, 2:supplier, 3:employee, 4:reseller
## With regard to CRUD, obviously the enum is hard-coded. Pretty sure that all will need to be done manually and very carefully as to respect values
## already stored on the database
## With regard to PartyRelationship Controller, record using relation, you will have to be mindful of your enum structure, eg, order
## Find
## irb(main):003:0> PartyRelationship.find(1).relation
## PartyRelationship Load (1.0ms) SELECT `party_relationships`.* FROM `party_relationships` WHERE `party_relationships`.`id` = 1 LIMIT 1
## => "supplier"
## update
## irb(main):008:0> PartyRelationship.find(1).update(relation: 3)
## PartyRelationship Load (0.0ms) SELECT `party_relationships`.* FROM `party_relationships` WHERE `party_relationships`.`id` = 1 LIMIT 1
## (0.0ms) BEGIN
## SQL (13.0ms) UPDATE `party_relationships` SET `relation` = 3, `updated_at` = '2015-08-25 14:00:58' WHERE `party_relationships`.`id` = 1
## (1.0ms) COMMIT
## => true
end
Hope this helps...
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/d7bc6b81-e5d3-47bd-9daa-ce630d0bbabc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.