Colin Law wrote in post #1184608:
>
> Possibly an even better solution to the OPs problem would be to use
> roles for different user types and not even have the complexity of
> STI. It depends how much role specific data and behaviour there is.
> My advice would be to start with just roles and
Colin Law wrote in post #1184606:
> On 13 July 2016 at 16:14, Johnny Stewart <li...@ruby-forum.com> wrote:
>>>> So, you don't need to keep all the chef or athlete data in the user
>> only has to handle registrations etc. I don't think there is any need to
>> hold d
Colin Law wrote in post #1184575:
> On 11 July 2016 at 19:41, Johnny Stewart <li...@ruby-forum.com> wrote:
>> in a table like ChefInfo
>>
>> then if user1 is a chef, he would have all the user info + type Chef and
>> he would have an entry in the chef table
&g
Greg Navis wrote in post #1184584:
> Yes, gems often make things more complicated than necessary. Regarding
> `spent` - if I earned 10 points and want to spend 2 how would you model
> this? I'm not sure whether that's possible in your app but it's a thing
> to
> keep in mind.
Good point - I will
> Thanks for your response.
> But isn't this a polymorphic association?. I'am trying to do exactly
> that with a polymorphic association, that is, create the user table with
> all the common information, and with meta_type:string (that saves the
> type of user) and meta_id:integer (that saves the
No tutorial that I know of..
You have the same information for all user types, namely just the
important information for users. So - you keep password, username, first
name, last name, email address etc in the User table.
Stuff like sport, training ground, weight, height, body-fat etc would go
Hi Greg,
yeah - I think I have abandoned using a gem for this and will roll my
own. I've had more of a look into it now and it doesn't look like as big
a job as I had imagined..
I think it will be easier to put a "spent" boolean on the point model
though, rather than create negative point
Ruth Stephenson wrote in post #1184508:
> Unfortunately, I have already tried that. When I click on the link it
> does nothing. It stays on whatever page i'm on but won't do
> anything.It's very strange
>
> Johnny Stewart wrote in post #1184507:
>> Ruth Stephenson wrote in pos
Ruth Stephenson wrote in post #1184504:
> ERROR:
> SQLite3::SQLException: no such column: appointments.appointment_date:
This is telling you that there is no appointment_date column in your
appointments table.
replace appointment_date with whatever you have named the appointment
date column in
Hi,
I am currently writing an ROR application which I am looking to add user
points to. I've been looking at Merit for this, but I don't know if it
is going to be right for what I am looking to get out of it. The points
are the main thing, but I may use the badges and rating features in the
I don't think you need to use polymorphism for this.
I'd use STI for users and just keep the very basics in the user
table(profile name, email address, type etc). Then have something like
chef_info and athlete_info tables which contain the rest of the
differing information for each user type.
Hi,
I have 2 views on which I am running some javascript for a rating:
from first view:
$(document).on('turbolinks:load', function() {
$('.star-rating').raty({
path: '/assets/',
readOnly: true,
score: function() {
return $(this).attr('data-score');
}
OK, next problem..
When I create a comment (from a form on the status page) the params hash
contains a parameter called:
status_entity_id
What I want is just:
entity_id
Processing by CommentsController#create as JS
Parameters: {"utf8"=>"✓", "comment"=>{"content"=>"testing123"},
Thanks Nanaya,
looks like that will do the trick!
Johnny
--
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, sen
Hi Fred,
@comments is a collection of comments on a status
Johnny
--
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 fro
Hmmm..
OK, I have put this in place:
class Comment < ApplicationRecord
belongs_to :user
belongs_to :published_entity, foreign_key: "entity_id"
but rails is still trying to use status_id..
(I have a class PublishedEntity which status inherits from)
class Status < PublishedEntity
I have changed the primary key on a table “statuses” to now be
entity_id
In my status model I have:
self.primary_key = 'entity_id'
when I try to render a collection of comments associated with a status
like so:
<%= render @comments %>
I get this error:
PG::UndefinedColumn: ERROR: column
When looking at comments which will be made on different types (say
post, picture, article) I see a lot of advice towards using polymorphic
associations for this. Ryan Bates has a good railscast on it:
http://railscasts.com/episodes/154-polymorphic-association-revised
However, I'm not sure I see
Hi there,
I'd take a look at attache:
https://github.com/choonkeat/attache-rails
https://github.com/choonkeat/attache
regards,
Johnny
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk&q
Hi Nanaya,
I saw that, but couldn't work out why the other answers made things so
complicated - I thought maybe I was not getting something important that
the extra model and db table allows.
I hadn't considered Enum - looking into it now..
--
Posted via http://www.ruby-forum.com/.
--
You
Hi Ryan,
yes that's about it - the choices I want to have will not be created by
user input (I don't think they are in the SO example either - I think
the OP only wants to allow the three choices he specified, which is why
I couldn't work out why the answers seemed to overcomplicate things so
I have a model where I want a few specific choices for a dropdown to set
a variable, very much like this:
http://stackoverflow.com/questions/14113057/how-to...
I'm trying to work out why all the answers to this question involve
creating a new model and db table just for the three choices
I have a model where I want a few specific choices for a dropdown to set
a variable, very much like this:
http://stackoverflow.com/questions/14113057/how-to-have-a-drop-down-select-field-in-a-rails-form
I'm trying to work out why all the answers to this question involve
creating a new model and
Thanks Colin,
solid advice, I'll just use the comparison and take it from there...
Johnny
--
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
to the table and update it after edit?
Or am I as well to just compare created_at and updated_at?
Or is there some mechanism I can use that makes more sense than either
of these?
Johnny
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google
I have a rails 5 project and have followed this tutorial to implement
commenting:
http://railscasts.com/episodes/154-polymorphic-association-revised
Comments are listed below the instance that they are associated with, I
have creating and deleting comments working with ajax, but I can't work
out
OK,
thanks Colin, I will most likely go that route then,
I dare say it will save pain later on should I want to do anything more
complex with this as well,
J.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on
Yes - I see that, it was late, got albums and images the wrong way round
there..
I've been learning for a few months now, so I've seen and completed that
tutorial and a few others. Its an excellent resource especially
considering its free!
I'm going to do a bit of reading up on associations
OK,
thanks for the pointers - I'll get through a bit of reading on this
tomorrow and see if I can't make enough sense of it to get something
working..
Thanks again,
J.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
hmmm...
OK - I was thinking:
User has_many Albums
User has_many Images through Albums
Image belongs_to User
Image belongs_to Album
Album has_one user
Album has_many images
am I overcomplicating things here? I have to say I'm not sure what the
advantages/disadvantages to the setup above
Interesting, do you mean this sort of thing:
http://guides.rubyonrails.org/association_basics.html
would you do that like-
has many through?
I'll take a look at that..
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
OK, I see what you mean, however, I'd like each user to have their own
categories only and they would likely only have 5 - 10 max for the most
part, as they would only be able to put each photo in one category so
the album analogy would work. So in that sense they are not really tags
like a
I've nothing specifically against it, but as I say I think just adding a
hash to the user model and then filtering on the entries therein seems
like it would be a lot more light weight no?
Is there some specific advantage I'd get by using acts_as_taggable_on?
--
Posted via
I'm working on an app which has an image upload facility for users, I
want users to be able to create 'albums' for their pictures.
The way I'm thinking about implementing this is to have a hash in the
user model for each user which they can add categories to and will then
be available as a
The snake case in your controller file name should be fine. What tutorial are
you using by the way? Is it online?
--
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
Secondarily, did you have a web server running already? If so, maybe try
restarting it?
--
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
This might not affect anything but can you see if the error happens if you
remove "resources :towcompanies", or reorder so the line with the root is
first?
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group
Can you post the contents from the controller in question?
On Saturday, February 27, 2016 at 10:37:32 AM UTC-8, Ruby-Forum.com User
wrote:
>
> Did that, still get the same error.
>
>
> Walter Davis wrote in post #1181701:
> > Sorry, autocorrect fail. The thing missing in yours was the to: key,
Can you provide the code from the views page in question?
--
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+unsubscr...@googlegroups.com.
is the new.
Do you know of any way to check the path associated with a cookie string?
On Friday, August 22, 2014 10:00:12 AM UTC-4, Frederick Cheung wrote:
On Thursday, August 21, 2014 3:37:27 PM UTC+1, Johnny wrote:
No, every request is to 'www.mydomain.com'.
Thanks.
Can you
No, every request is to 'www.mydomain.com'.
Thanks.
On Thursday, August 21, 2014 9:52:04 AM UTC-4, Frederick Cheung wrote:
On Wednesday, August 20, 2014 9:57:57 PM UTC+1, Johnny wrote:
I'm having an issue with my Rails 3.2.19 app.
If someone is idle on our site for 20 minutes and they had
I'm having an issue with my Rails 3.2.19 app.
If someone is idle on our site for 20 minutes and they had items in their
cart, then on their next request, we clear their cart, redirect them to the
homepage and display a message telling them that their session expired.
Roughly this is what
The example included says...
class Customer ActiveRecord::Base
has_many :orders, inverse_of: :customer
end
class Order ActiveRecord::Base
belongs_to :customer, inverse_of: :orders
end
---
Later on, the guid mentions...
There are a few limitations to inverse_of support:
- They do
I'm looking for some advice on contributing to Rails (and other large
projects).
I will provide a specific scenario.
Here is a pull request https://github.com/rails/rails/pull/3329 that was
merged a year ago.
In the past month, three people have commented that this introduces another
issue
Running ruby 1.9.3 and Rails 3.2.8.
I feel like I'm not fully understanding how CSRF works.
I have `protect_from_forgery` in my ApplicationController.
So, now should all non-GET requests require an authentication token?
Specifically, I have a `destroy`method that doesn't seem to care if a
I'm trying to post multipart content (a file and some strings) to a
Sinatra server on localhost using a java client. It seems the server
doesn't like the POST message. The stack trace is:
ERROR NoMethodError:
I'm reading Dive into html5 and in
http://diveintohtml5.org/semantics.html#encoding
, it says every page should contain meta charset=utf-8 /,
otherwise it's subject to security vulnerabilities (http://
code.google.com/p/doctype/wiki/ArticleUtf7). I don't see meta
charset=utf-8 / being generated
Hi,
I know it could be an annoying question for skilled developers but we
have a major issue... this website ( http://www.swissdnabank.com )
worked fine til this afternoon, then suddenly appeared this error
page... what could have happened?
--
Posted via http://www.ruby-forum.com/.
--
You
How to redirect www to non-www? e.g redirect www.example.com to
example.com
Thanks
Johnny
--
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from
, unexpected keyword_end,
expecting $end
/var/www/project/005/Rakefile:9:in `require'
(See full trace by running task with --trace)
Deeply appreciate any help.
Regards
Johnny
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post
I want to set the Time.zone to the user's current time zone, I don't
want to store the timezone in user profile like many other solutions.
How to do that?
Thanks
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send
.
[]'s
Rodrigo Dellacqua
On Sun, Jan 10, 2010 at 8:31 PM, Johnny Shi johnny.t@gmail.com wrote:
I want to set the Time.zone to the user's current time zone, I don't
want to store the timezone in user profile like many other solutions.
How to do that?
Thanks
--
You received
How does time_zone_select works?
I have:
%= form.datetime_select :datetime, :default = Time.now %
all datetime are in UTC in the database, here is two questions:
1. how do I add the option for user to select time zone? how to user
time_zone_select?
2. what is the proper way to handle that in
controller, to determine whether the category
belong to an account or a project, i use if param['project_id'],
again is this the proper way to do it?
Appreciate any help,
Regards,
johnny
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group
(checking gem p4ruby-1.0.7 for P4)
/usr/local/lib/ruby/gems/1.8/gems/p4ruby-1.0.7/lib/P4.rb
Should I set an env var? If so, which and where?
-Johnny
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk
I like the ease of use that ruby on rails provides. But before I
switch over completely from ASP.NET, I would like to know what sort of
gui's are available for rubyonrails.
I like the asp.net webparts. With webparts, I can divide the website
into zones and then put modules into those zones.
56 matches
Mail list logo